Skip to content

JDK source files not opening in the editor when stepping to JDK classes (unknown sources in the call stack).  #1437

Closed

Description

@ddavoren

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.

Environment
  • Operating System: Windows 10 Enterprise
  • JDK version: openjdk version "1.8.0_292"
  • Visual Studio Code version:
    Version: 1.86.0 (user setup)
    Commit: 05047486b6df5eb8d44b2ecd70ea3bdf775fd937
    Date: 2024-01-31T10:28:19.990Z
    Electron: 27.2.3
    ElectronBuildId: 26495564
    Chromium: 118.0.5993.159
    Node.js: 18.17.1
    V8: 11.8.172.18-electron.0
    OS: Windows_NT x64 10.0.19044
  • Java extension version: v0.25.15
  • Java Debugger extension version: v0.56.0
Steps To Reproduce
  1. Attach to remote WSL maven project.
  2. WSL using Apache Maven 3.6.3, with openJDK 8.
  3. Create a simple program with JDK classes.
  4. Debug the program and try to step into the JDK classes.
  5. 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.

Additional Informations

Activity

  1. ddavoren commented on Feb 9, 2024

    @ddavoren
    Author

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions