Skip to content

fix(java): discover JDKs in the standard Windows and Linux locations - #17

Merged
1lck merged 2 commits into
mainfrom
fix/jdk-discovery-windows-linux
Nov 16, 2026
Merged

1lck merged 2 commits into
mainfrom
fix/jdk-discovery-windows-linux

Conversation

@1lck

@1lck 1lck commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

关联 Issue:1lck/Lithe-IDEA#2032

问题

java 工具定义的 discovery 只声明了 macOS 的两个目录(/Library/Java/JavaVirtualMachines 和 ~/Library/Java/JavaVirtualMachines),所以 Windows 和 Linux 上永远没有扫描到的 JDK。新建项目的 JDK 选择器因此显示"未找到已安装的版本。此项必填。",但运行时通过 JAVA_HOME 或 PATH 其实能找到 JDK。

改动(只改 plugin.json 的 discovery)

平台 新增扫描
Windows C:\Program Files\Java\*、Eclipse Adoptium\*、Microsoft\jdk-*、Zulu\*、Amazon Corretto\*、BellSoft\*
Linux /usr/lib/jvm/*
Windows、Linux ~/.jdks/*(IntelliJ IDEA 下载的 JDK)
macOS、Linux ~/.sdkman/candidates/java/*
  • 用绝对路径而不是 ProgramFiles 环境变量,是因为 Core 只接受全大写的环境变量名。
  • 装在其他位置的 JDK(比如反馈里的 D:\Program Files\Java\Temurin\jdk-*)由宿主侧的修复覆盖:Core 把 JAVA_HOME 和 PATH 上的 JDK 也列为可选安装,见 Lithe-core-rust#67。
  • 扫描结果仍然要经过 Core 的可执行文件检查和版本探测,不是 JDK 的目录不会被列出。

验证

  • 在宿主的工具链加载测试里(临时测试,未提交)用真实 Core 加载这份 plugin.json,平台设为 Linux。~/.jdks/jdk-21 和 ~/.sdkman/candidates/java/17.0.9-tem 都被列为 host:system 安装,manifest 通过 Core 校验。
  • Windows 的 C:\Program Files\... 扫描还没在 Windows 实机验证,等宿主 PR 能构建出 Windows 版后补测。
  • 合入后需要发布新版插件,用户才会拿到这个改动。

🤖 Generated with Claude Code

The JDK tool definition declared discovery scans for macOS only, so on Windows and
Linux no JDK was ever an installation: New Project's JDK picker said no version
was installed (1lck/Lithe-IDEA#2032) although runs found one through JAVA_HOME or
the PATH.

- Windows: C:\Program Files\Java, Eclipse Adoptium, Microsoft (jdk-*), Zulu,
  Amazon Corretto and BellSoft.
- Linux: /usr/lib/jvm.
- Windows and Linux: ~/.jdks (JDKs IntelliJ IDEA downloads).
- macOS and Linux: ~/.sdkman/candidates/java.

Discovery roots are absolute paths because Core only accepts upper-case
environment variable names, and Windows spells this one ProgramFiles. A JDK
anywhere else is still listed through JAVA_HOME or the PATH (Lithe-core-rust#67).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@1lck
1lck marked this pull request as ready for review November 16, 2026 11:28
@1lck
1lck merged commit 84a8566 into main Nov 16, 2026
5 of 10 checks passed
@1lck
1lck deleted the fix/jdk-discovery-windows-linux branch November 16, 2026 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant