redhat-developer / redhat-developer/vscode-java
Irrelevant "Invalid runtime for JavaSE-21" on start with WSL
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 546
- Avg merge
- 20h 1m
- Merged PRs (30d)
- 11
Description
Describe the bug
I run vscode with WSL.
Bujt on startup, I get this message:
"Invalid runtime for JavaSE-21: The path points to a missing or inaccessible folder (c:\Program Files\Amazon Corretto\jdk21.0.9_10)."
It should not try a Windows path from WSL Remote. I suspect it either walks over all $PATH entries, or falsely evaluates the Windows side JAVA_HOME.
After closing the message, everything works fine, it correctly uses the JDK in Linux/WSL for everything.
To Reproduce
(Have a valid JDK installed in Windows. I have it in the Windows PATH, and JAVA_HOME set)
Steps to reproduce the behavior:
- Start VSCode on a project residing in WSL
- Wait a few seconds for the message to pop up.
Expected behavior
Not showing that message.
Environment
- Operating System: Windows
- JDK version: 21 (The mistakenly picked up Amazon Corretto on Windows, and either OpenJDK or Corretto within WSL)
- Visual Studio Code version: 1.127.0
- Java extension version: 1.55.0
Additional Information
I tried these things:
- Checking for the path in any configuration (workspace, user, WSL, project)
- deleting ~/.vscode-server completely in WSL
- deleting globalStorage and workspaceStorage in Windows %APPDATA%
- disable "Detect JDK at startup" option, no effect.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the startup warning in a VS Code project opened through WSL, then trace Java runtime detection and how Windows PATH or JAVA_HOME is evaluated in the remote context. Done means the Windows JDK is not reported as invalid while the valid WSL JDK continues to be used and no warning appears.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, typescript, vscode
- Domain
- devtools, operating-systems, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100