You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JDK source files not opening in the editor when stepping to JDK classes (unknown sources in the call stack). #1437
I am using VS code with WSL2 remote connection.
It's a maven project and its using openJDK 8.
When I launch the java debugger, I can debug into maven dependencies, but when I try to debug into JDK class files, I get "unknown source". I have checked the openJDK 8 installation and the src.zip file is there $JAVA_HOME/src.zip
I have JAVA_HOME set in my env in WSL to point to the openJDK 8 version.
I also tried setting "java.jdt.ls.java.home" in the settings.json file but VS code complains the java version does not meet minimum requirements.
Is there a way to configure the java debugger to use the openJDK 8 src.zip file with this setup.
Debug the program and try to step into the JDK classes.
Unknown source is indicated when debugging into the JDK classes.
The program to re-produce is as simple as the following:
public static void main(String[] args) {
String test = new String("test");
LOGGER.info("{}", test);
}
Set a breakpoint on new String and try to step into the constructor.
Note, in the java projects view, I can see the JRE system library and browse the JDK code with no issues.
I can even put a breakpoint into the JDK source code (String constructor in this case), and run to that breakpoint, but the source code does not pop up in the editor, I see unknown source in the call stack.
Current Result
Unknown source for JDK classes when trying to debug.
Expected Result
Debugger can step into source code for JDK classes.
The issue was the src.zip file in the JDK was pointing to a broken link.
The jdk sources were installed in a different location so fixing the link solved the problem.
Activity
ddavoren commentedon Feb 9, 2024
The issue was the src.zip file in the JDK was pointing to a broken link.
The jdk sources were installed in a different location so fixing the link solved the problem.