redhat-developer / redhat-developer/vscode-java

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

未关闭
#4,456 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

bug
主要语言
TypeScript
星标
2.3k
派生
546
平均合并
20 小时 1 分钟
30 天内合并 PR
11

描述

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.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先,在通过 WSL 打开的 VS Code 项目中复现启动警告,然后跟踪 Java 运行时检测,以及在远程上下文中如何评估 Windows PATH 或 JAVA_HOME。完成的标准是:Windows JDK 不再被报告为无效,同时继续使用有效的 WSL JDK,并且不出现警告。

由索引模型根据 Issue 内容生成。

评估

技术栈
java, typescript, vscode
领域
devtools, operating-systems, tooling
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。