Skip to content

Irrelevant "Invalid runtime for JavaSE-21" on start with WSL #4456

Description

@MartinEmrich

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:

  1. Start VSCode on a project residing in WSL
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions