Skip to content

Always launching jre instead of JDK #366

Closed

Description

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

Activity

  1. testforstephen commented on Sep 4, 2018

    @testforstephen
    Contributor

    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.

  2. testforstephen commented on Sep 14, 2018

    @testforstephen
    Contributor

    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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions