Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always launching jre instead of JDK #366

Closed
andxu opened this issue Aug 14, 2018 · 2 comments
Closed

Always launching jre instead of JDK #366

andxu opened this issue Aug 14, 2018 · 2 comments
Assignees
Milestone

Comments

@andxu
Copy link
Contributor

andxu commented Aug 14, 2018

Steps:
Open any project and write "new String("");" and step in the String constructor,

The variable should be two:

  1. original
  2. this

but actual the parameter for String constructor is arg0 which indicating that the program is running at jre env,eg:

n:\jdk1.8.0_181\jre\bin\java -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=localhost:9316,server=n,suspend=y -Dfile.encoding=UTF-8 -cp C:\work\vscode-java-debug\testprojects\8.nosource\bin;C:\work\vscode-java-debug\testprojects\8.nosource\lib\test1.jar;C:\work\vscode-java-debug\testprojects\8.nosource\lib\commons-io-2.5.jar NoSourceTest
@andxu andxu added this to the 0.13.0 milestone Aug 30, 2018
@testforstephen testforstephen mentioned this issue Aug 30, 2018
15 tasks
@testforstephen
Copy link
Contributor

testforstephen commented Sep 4, 2018

The Java debugger will use the API System.getProperty("java.home") to resolve java bin path, and use it to launch the debuggee. For windows, the value of System.getProperty("java.home") is read from the registry HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft, and it's generally pointing to the JRE. This is the reason why the debuggee is launched in JRE instead of JDK.

To fix the issue, we need read the java bin path from the user environment variable JAVA_HOME. And follow Java Language Server to use the same JDK to launch the debuggee.

@testforstephen
Copy link
Contributor

testforstephen commented Sep 14, 2018

Launching the debuggee with the correct JDK still has similar local variable name missing issue when debugging JDK source code. The JDK library is located in rt.jar, but the rt.jar in the official oracle JDK installation doesn't contain the debug symbol for the local variables. That's why the debugger cannot get the correct parameter names and local variable info for JDK method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants