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

Cannot debug java core Classes #1396

Closed
ECEAthipanbose opened this issue Sep 26, 2023 · 8 comments
Closed

Cannot debug java core Classes #1396

ECEAthipanbose opened this issue Sep 26, 2023 · 8 comments

Comments

@ECEAthipanbose
Copy link

cannot step into the println method in vscode
in call stack its tell printsteam as unknown source
please tell how to debug system.out.println and jum into printstream class, there is any launch.json for configure this?

@testforstephen
Copy link
Contributor

pls check if your JDK home contains jdk src.zip.

@ECEAthipanbose
Copy link
Author

ECEAthipanbose commented Sep 27, 2023

yes its contains but still cant step into the java core classes,
its only work on the jdk-11.0.18+10 but i use other version jre like 1.8 or 17 its not work
In the vscode-java-debug , sourceContainer does not match with java/io/printstream so stacktrace request retuen null as source for printstream so debug in vscode java does not move to the printstream.class and display unknown source in call stack

its possible to debug printstream.class (source code produce by fern flower decompiler) in vscode-java?

@testforstephen
Copy link
Contributor

Please use the decompiled source code for debugging. The debugger relies on the language support extension to find the original source code. If the debugger cannot locate the source code, then the Go to Definition feature will also fail. No clue what is causing the problem for you. You could try using a different JDK installation and see if that helps.

@ECEAthipanbose
Copy link
Author

there is any documentation available for debug java core classes?

@testforstephen
Copy link
Contributor

If your JDK home contains a src.zip (for java 1.8, it's under $JAVA_HOME/src.zip, for java 11+, $JAVA_HOME/lib/src.zip), the Java extension is supposed to discover your JDK sources automatically. However, you can try to use "java.configuration.runtimes" settings to configure your JDK source manually.

"java.configuration.runtimes": [
        {
            "name": "JavaSE-11",
            "path": "C:\\Program Files\\Microsoft\\jdk-11.0.14.9-hotspot",
            "sources": "/path/your/jdk/src.zip",
        }
]

@ECEAthipanbose
Copy link
Author

Thank you bro , Thank for reply , now its work well bro

@testforstephen
Copy link
Contributor

close it since you have solved the issue.

@ECEAthipanbose
Copy link
Author

hi, In recent
"java.configuration.runtimes": [
{
"name": "JavaSE-11",
"path": "C:\Program Files\Microsoft\jdk-11.0.14.9-hotspot",
"sources": "/path/your/jdk/src.zip",
}
]
i mention the above configuration in runtime configuration ,
but when i debug (step into the) system.out.println its navigate to printstream.class decomplie source (// Source code is decompiled from a .class file using FernFlower decompiler.) and highlight the last line ,

its not navigate to printstream.class source code
(/*

  • Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
  • DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  • This code is free software; you can redistribute it and/or modify it
  • under the terms of the GNU General Public License version 2 only, as
  • published by the Free Software Foundation. Oracle designates this
  • particular file as subject to the "Classpath" exception as provided
  • by Oracle in the LICENSE file that accompanied this code.
  • This code is distributed in the hope that it will be useful, but WITHOUT
  • ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  • FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  • version 2 for more details (a copy is included in the LICENSE file that
  • accompanied this code).
  • You should have received a copy of the GNU General Public License version
  • 2 along with this work; if not, write to the Free Software Foundation,
  • Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  • Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  • or visit www.oracle.com if you need additional information or have any
  • questions.
    */)
    note:- debug session frame contain the line and column of the source code but its open the decompiled source code so,that line is not present in decompile source it so mismatch happen

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