Java Debugger Launch Failure
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
先使用 Debug Java 動作搭配任何 .java 檔案重現此失敗,然後檢查 settings.json 和 Java Language Server 記錄,找出報告中顯示的遺失 workspace 路徑、build-path 和 package 錯誤。當偵錯工具能在沒有 ClassNotFoundException 的情況下成功啟動,且 workspace 建置時沒有這些錯誤,即表示完成。
由索引模型根據 Issue 內容生成。
描述
Environment
- Operating System: MacOS Big Sur
- JDK version: 21
- Visual Studio Code version: Version: 1.84.2
- Java extension version: v1.24.0
- Java Debugger extension version: 0.55.0
Issue
Java Debugger fails to launch: "Build failed, do you want to continue?"
If I click "Continue", the resulting error message occurs:
"Error: Could not find or load main class [filename-here]
Caused by: java.lang.ClassNotFoundException: [filename-here]"
This has been a recurrent issue for the past three months – Java Debugger goes from seemingly working to being completely unusable at random. Each time I think I've resolved the issue, the same launch failure begins to occur a week later without rhyme or reason, and the temporary "fix" seems to be different each time.
Per the errors above and below, this appears to be a configuration issue: potentially with the language server and/or java class path configuration. However, none of the suggested solutions in the Troubleshooting Guide have worked. I've tried completely wiping all Java configuration files and extensions several times (it worked as a temporary fix once, but not the next time); but even then, the solution was only temporary.
Currently, it appears the JAVA_HOME environment variable is not set, as echo outputs a blank line:
$ echo $JAVA_HOME
However, resetting it manually using command line export seemingly has no effect, and I have the following in settings.json already:
"java.jdt.ls.java.home": "/Library/Java/JavaVirtualMachines/jdk-21.jdk/Contents/Home",
Log Report
The following relevant errors can be seen in the log:
!ENTRY org.eclipse.jdt.ls.core 4 0 2023-11-22 21:24:07.717
!MESSAGE _/HES Pro/Comp A/Temp/TestDir [in Program Folder_e362262e] does not exist
!STACK 1
Java Model Exception: Error in Java Model (code 969): _/HES Pro/Comp A/Temp/TestDir [in Programming Folder_e362262e] does not exist
!ENTRY org.eclipse.jdt.ls.core 4 0 2023-11-22 20:53:33.404
!MESSAGE failed to send diagnostics
!STACK 1
Java Model Exception: Error in Java Model (code 1006):_/HES Pro/Comp A/Temp/TestDir [in Programming Folder_e362262e] is not on its project's build path
!ENTRY org.eclipse.jdt.ls.core 4 0 2023-11-22 21:25:37.701
!MESSAGE Error occured while building workspace. Details:
message: The declared package "" does not match the expected package "HES Pro.Comp A.Temp.TestDir"; code: 536871240; resource: /Users/myUsername/Documents/Programming Folder/HES Pro/Comp A/Temp/TestDir/BadExample.java; line: 1
Steps Taken
- Cleaned Java Language Server Workspace
- Completely uninstalled Java Extension Pack & completely wiped all workspace specific configurations
- Reset JAVA_HOME environment variable
- Reset/changed class/source path configurations multiple times
- Exhausted steps suggested in Troubleshooting Guide that appeared relevant...
Steps To Reproduce
- Open any
.javafile - Click
Debug Javain upper-right hand corner of VSCode editor window.
https://github.com/microsoft/vscode-java-debug/assets/42523932/41049820-57f7-4cf3-af84-efd58d90070b
Note: There does not appear to be anything project specific that influences this issue. It's appears to be primarily a workspace issue, such that the error occurs on my system when executing any .java file and it does not matter whether I use my own debug launch config or the default VSCode debug (per above). Unsure how reproducible this is outside of my own system.
Additional Informations
This issue has made VSCode borderline unusable at times which is very frustrating. I use VSCode exclusively for all other languages, and have been a big fan, but I'm not sure if it's time to start considering using another editor for Java. I'm also unclear why temporary fixes have seemed to work, only to break after some indeterminate period of time.
I've wondered if the "spaces" in my directory names might be causing inconsistencies in resolving the class path; but I would find that perplexing considering, while I'm new to Java, it's never remotely been an issue with using VSCode with other languages, nor can I amend my entire directory structure very easily.
- 主要語言
- TypeScript
- 星號
- 591
- 分支
- 431
- 平均合併
- 10 小時 25 分鐘
- 30 天內合併 PR
- 9
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
microsoft/vscode-java-debug 的其他 Issue
-
java未關閉ai-triaged needs more info
難度 5/5 一週以上 新手友好度 1/100
microsoft/vscode-java-debug#1707 · 1 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆
-
Stopping a Java Application with the debugger Stop button dos not work可能已有人在做 @chagong 於 12 天前認領。 未關閉ai-triaged bug
microsoft/vscode-java-debug#1705 · 1 則留言 · 1 個 reaction · 已指派 1 人 ·
維護者通常 1 天內回覆
-
ai-triaged enhancement
難度 3/5 1-2 天 新手友好度 55/100
microsoft/vscode-java-debug#1689 · 3 則留言 ·
維護者通常 1 天內回覆
-
Extension appends malformed string to PATH可能重新可做 @wenytang-ms 於 61 天前認領,目前沒有進行中的 PR。 未關閉ai-triaged bug
microsoft/vscode-java-debug#1666 · 1 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
ai-triaged bug
難度 3/5 1-2 天 新手友好度 48/100
microsoft/vscode-java-debug#1658 · 1 則留言 ·
維護者通常 1 天內回覆
查看 microsoft/vscode-java-debug 的全部 Issue
相似的 Issue
-
awaiting-response bug needs-triage
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 3 天內回覆
-
難度 1/5 1 小時以內 新手友好度 72/100
supadata-ai/mcp#27 ·
-
content
難度 2/5 1-3 小時 新手友好度 72/100
cosimochellini/one-piece-zero-spoiler#516 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 72/100
capricorn86/happy-dom#2485 ·
維護者通常 2 天內回覆
-
lane: fast
難度 2/5 1-3 小時 新手友好度 62/100
unicef/adt-studio#946 ·
維護者通常 2 天內回覆