Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

VSCode doesn't show JDK Java source files when debugging JDK itself

未關閉
#1,285 3 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
35/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
java, typescript, vscode
領域
devtools

研究方向

先從報告中顯示的 launch.json javaExec、classPaths 和 java.configuration.runtimes 設定開始,然後追蹤 Java 偵錯工具如何為 JDK 類別選取原始碼。使用列出的 OpenJDK Main.java 變更重現此問題,並驗證偵錯顯示的是變更後的 Java 原始碼,而不是不相容的類別檢視。

由索引模型根據 Issue 內容生成。

描述

ai-triaged question sourcemap

I'm building and debugging the latest version of OpenJDK on Windows 11. I'd like to debug it with VSCode, however I met the following problem:

I made changes in JDK Java sources (say added System.out.println("Hello") in src\jdk.javadoc\share\classes\jdk\javadoc\internal\tool\Main.java) and built JDK using JDK19 as boot JDK. I run my Java test using my freshly built JDK. It successfully starts and prints "Hello". Then I set a breakpoint at the line after my change in VSCode, and run the test under VSCode debugger. It starts, prints "Hello", and stops on my breakpoint, and shows source code, but I can't see my changes, because VSCode loaded jdk.javadoc\jdk.javadoc.internal.tool\Main.class instead of the changed Main.java.

I suppose, the class file was taken from java.configuration.runtimes, but I have no idea how can I force VSCode to load changed sources while debugging. Although VSCode is still able to show and debug my own Java-files, and, moreover, modified native JDK code (C/C++ sources), not Java.

BTW I've got the following pop-up message when debugger starts: "The compiled classes are not compatible with the runtime JDK."

Environment
  • Operating System: Windows 11
  • JDK version: 19
  • Visual Studio Code version: 1.74.3
  • Extension pack for Java: 0.25.7
  • Java Debugger extension version: 0.47.0
Steps To Reproduce
  1. Clone openjdk repository (https://github.com/openjdk/jdk.git) and build it
  2. Make a little change in JDK's Java source file, e.g. add System.out.println("Hello") in src\jdk.javadoc\share\classes\jdk\javadoc\internal\tool\Main.java
  3. Set a breakpoint at the changed line and try to debug it with VSCode
Current Result

VSCode stops at the breakpoint, loads *.class file, which doesn't contain my changes.

Expected Result

VSCode stops at the breakpoint, loads changed *.java files and shows them in debugger.

Additional Informations

My setting.json:

"java.configuration.runtimes": [
    {
        "default": true,
        "name": "JavaSE-19",
        "path": "c:\\work\\jdk19",
    }
],

My launch.json:

{
    "type": "java",
    "name": "(java) Debug",
    "request": "launch",
    "cwd": "${workspaceFolder}",
    "mainClass": "jdk.javadoc.internal.tool.Main",
    "javaExec": "${workspaceFolder}\\build\\windows-x86_64-server-fastdebug\\jdk\\bin\\java.exe",
    "classPaths": [
        "${workspaceFolder}/build/windows-x86_64-server-fastdebug/images/jdk/lib/jrt-fs.jar",
    ],
},
主要語言
TypeScript
星號
591
分支
429
平均合併
1 天 1 小時
30 天內合併 PR
20

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

microsoft/vscode-java-debug 的其他 Issue

查看 microsoft/vscode-java-debug 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。