Title: [Bug] jdtls-runtime 优先命中 PATH 旧版 java,且复用 redhat.java 的 JDT LS 1.63(需 Java 25)时用 JDK 21 启动崩溃退出 · Issue #27 · Lithe-IDEA/lithe-plugin-java · GitHub
Open Graph Title: [Bug] jdtls-runtime 优先命中 PATH 旧版 java,且复用 redhat.java 的 JDT LS 1.63(需 Java 25)时用 JDK 21 启动崩溃退出 · Issue #27 · Lithe-IDEA/lithe-plugin-java
X Title: [Bug] jdtls-runtime 优先命中 PATH 旧版 java,且复用 redhat.java 的 JDT LS 1.63(需 Java 25)时用 JDK 21 启动崩溃退出 · Issue #27 · Lithe-IDEA/lithe-plugin-java
Description: Platform / 平台 Windows Area / 模块 Language support / 语言服务 Lithe version / Lithe 版本 Lithe Desktop 0.8.1 + Java Support v3.0.1(Windows / macOS / Linux 均受影响) Priority / 优先级 P0 / 立即处理:已严重影响使用体验,核心流程受阻或无法正常使用 OS and architecture / 操作系统与架构 Windo...
Open Graph Description: Platform / 平台 Windows Area / 模块 Language support / 语言服务 Lithe version / Lithe 版本 Lithe Desktop 0.8.1 + Java Support v3.0.1(Windows / macOS / Linux 均受影响) Priority / 优先级 P0 / 立即处理:已严重影响使用体验,核心流程受阻或无法...
X Description: Platform / 平台 Windows Area / 模块 Language support / 语言服务 Lithe version / Lithe 版本 Lithe Desktop 0.8.1 + Java Support v3.0.1(Windows / macOS / Linux 均受影响) Priority / 优先级 P0 / 立即处理:已严重影响使用体验,核心流程受阻或无法...
Opengraph URL: https://github.com/Lithe-IDEA/lithe-plugin-java/issues/27
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug] jdtls-runtime 优先命中 PATH 旧版 java,且复用 redhat.java 的 JDT LS 1.63(需 Java 25)时用 JDK 21 启动崩溃退出","articleBody":"### Platform / 平台\n\nWindows\n\n### Area / 模块\n\nLanguage support / 语言服务\n\n### Lithe version / Lithe 版本\n\nLithe Desktop 0.8.1 + Java Support v3.0.1(Windows / macOS / Linux 均受影响)\n\n### Priority / 优先级\n\nP0 / 立即处理:已严重影响使用体验,核心流程受阻或无法正常使用\n\n### OS and architecture / 操作系统与架构\n\nWindows 10.0.26200 (amd64)(实测 macOS arm64 同样复现)\n\n### Environment / 环境信息\n\n- **插件版本**:`io.github.lithe-idea.java-support` `v3.0.0` / `v3.0.1`(自 #18 起改为使用本机 JDT LS 与 `jdtls-runtime` 工具)\n- **项目 JDK(`java` 工具)与系统 `PATH` 默认 `java`**:Java 8(`1.8.0_301`)\n- **语言服务器启动 JDK(`jdtls-runtime` / `JDK for JDT LS`)**:\n - 阶段一(默认自动选择):命中 `PATH` 上的 Java 8(`1.8.0_301`)\n - 阶段二(按报错提示改为 JDK 21):Java 21\n- **本机自动发现的 JDT LS**:VS Code `redhat.java` 扩展自带的 `server/`(如 `redhat.java-1.58.0` 内置的 JDT LS `1.63.0.202610161533`)\n\n### Steps to reproduce / 复现步骤\n\n1. 在电脑上安装 Java 8(配置在系统 `PATH` 中)以及更高版本的 JDK(如 JDK 21),并安装有 VS Code `redhat.java` 扩展(如 `1.58.0`,内置 JDT LS `1.63.0`)。\n2. 将 Java Support 插件升级到 `v3.0.1`,打开任意 Java 项目。\n3. **现象一**:未手动配置 `JDK for JDT LS` 时,`jdtls-runtime` 优先命中了 `PATH` 上的 Java 8,触发 `launch.runtime_too_old`,报错提示用户:\n `The Eclipse JDT Language Server needs Java 21 or later, but the JDK chosen for it is older. Choose a JDK 21 or later for \"JDK for JDT LS\" in Settings > Build, Execution, Deployment > Toolchains.`\n4. **现象二**:按报错提示在「设置 → 构建、执行、部署 → 工具链」将 `JDK for JDT LS` 设为 **JDK 21** 后重新打开项目:\n - `java.resolveLaunch` 检查通过(`21 >= 21`),并定位到 `redhat.java` 扩展下的 JDT LS `1.63.0`;\n - 宿主启动 JDT LS 进程约 4 秒后,Equinox 因核心 bundle 要求 `JavaSE-25` 解析失败而直接以退出码 `13` 退出,宿主报 `code=\"host.exitedEarly\"` / `code=\"serverExited\"`,语言服务依然无法启动。\n\n### Expected behavior / 预期行为\n\n1. **自动选择最高版本已安装 JDK,不被 `PATH` 上的旧版 `java` 抢占**:\n - 如 `docs/releases/v3.0.0.md` 所承诺(“不选时自动使用找到的最高版本 JDK”),`plugin.json` 中 `jdtls-runtime` 的 `executables` 应优先使用自动扫描到的已安装最高版本 JDK(`detected`,`kind: \"toolchain\", scope: \"installed\"`),而不是把 `shell`(`kind: \"command\", command: \"java\"`)排在 `detected` 前面导致日常 Java 8/17 开发环境的 `PATH` 抢占 `jdtls-runtime`。\n2. **复用编辑器扩展自带 JDT LS 时,支持发现其配套的 JRE**:\n - VS Code / Cursor 的 `redhat.java-*` 扩展在 `server/` 旁自带了匹配当前 JDT LS 版本的运行时(`~/.vscode/extensions/redhat.java-*/jre/\u003cversion>/`)。`jdtls-runtime` 的发现规则或启动解析应能识别该运行时,避免借用了要求 Java 25 的 `redhat.java` JDT LS 却找不到对应的 Java 25 运行时。\n3. **按目标 JDT LS 实际要求的最低 Java 版本校验 `jdtls-runtime`**:\n - JDT LS `1.61.0` 的 `org.eclipse.core.filesystem_1.11.500` 声明 `Bundle-RequiredExecutionEnvironment: JavaSE-17`(运行需 Java 21+),但 JDT LS `1.63.0`(如 `redhat.java-1.58.0`)中的 `org.eclipse.core.filesystem_1.12.0.v20260927-0940` 已升级为 **`Bundle-RequiredExecutionEnvironment: JavaSE-25`**。\n - `check_server_runtime` 不应只硬编码 `MINIMUM_SERVER_JAVA_VERSION = 21`,而应结合目标 JDT LS 安装包要求的 Java 版本检查 `jdtls-runtime`;当用户选择的 JDK(如 JDK 21)低于目标 JDT LS 要求的版本(如 Java 25)时,在 `java.resolveLaunch` 阶段直接返回明确错误码与所需版本号,而不是放行后让 Equinox 启动 4 秒后以退出码 `13` 崩溃。\n\n### Actual behavior / 实际行为\n\n1. `io.github.lithe-idea.java-support/plugin.json`(第 298–320 行)中 `jdtls-runtime` 的 `executables` 顺序为 `default` → `global-request` → `shell` → `detected`,导致只要 `PATH` 上是 Java 8/11/17,`detected` 就永远不会被用到。\n2. 用户按提示将 `JDK for JDT LS` 改为 JDK 21 后,`check_server_runtime`(硬编码 `MINIMUM_SERVER_JAVA_VERSION = 21`)放行,但自动发现的 `redhat.java` JDT LS `1.63.0` 要求 `JavaSE-25`,进程启动 4.3 秒后因 OSGi bundle 无法解析而直接退出(`host.exitedEarly`)。\n\n### Logs or diagnostic output / 日志或诊断输出\n\n```shell\n# 1. Lithe 诊断日志(plugins/io.github.lithe-idea.java-support/host.log & lsp/*.log)\n2026-11-17T06:39:29.890Z INFO seq=41 event=plugins.operation.finished op=host-call-1 msg=\"Plugin operation finished\" duration_ms=415 operation=java.resolveLaunch plugin=io.github.lithe-idea.java-support\n2026-11-17T06:39:38.384Z INFO seq=74 event=lsp.process.started msg=\"Language service process started for server invalid-fa2bed2161954417597454e752c9ee70\" server=invalid-fa2bed2161954417597454e752c9ee70\n2026-11-17T06:39:42.683Z ERROR seq=75 event=plugins.operation.failed op=action-1 msg=\"Plugin operation failed\" code=host.exitedEarly duration_ms=16136 operation=languageServer/start plugin=io.github.lithe-idea.java-support\n2026-11-17T06:39:42.684Z ERROR seq=76 event=lsp.session.failed msg=\"Engine session failed\" code=serverExited server=invalid-fa2bed2161954417597454e752c9ee70 state=failed\n\n# 2. 用 JDK 21 启动 redhat.java (JDT LS 1.63.0) 时的 Equinox jdt.log 报错(Exit code 13)\n!ENTRY org.eclipse.buildship.core 4 0 2026-11-16 22:55:28.296\n!MESSAGE FrameworkEvent ERROR\n!STACK 0\norg.osgi.framework.BundleException: Could not resolve module: org.eclipse.buildship.core [22]\n Unresolved requirement: Require-Bundle: org.eclipse.jdt.core\n -> Bundle-SymbolicName: org.eclipse.jdt.core; bundle-version=\"3.48.0.v20261007-1246\"; singleton:=\"true\"\n org.eclipse.jdt.core [49]\n Unresolved requirement: Require-Bundle: org.eclipse.core.resources; bundle-version=\"[3.22.0,4.0.0)\"\n -> Bundle-SymbolicName: org.eclipse.core.resources; bundle-version=\"3.25.0.v20261010-1447\"; singleton:=\"true\"\n org.eclipse.core.resources [31]\n Unresolved requirement: Require-Bundle: org.eclipse.core.filesystem; bundle-version=\"[1.11.0,2.0.0)\"\n -> Bundle-SymbolicName: org.eclipse.core.filesystem; bundle-version=\"1.12.0.v20260927-0940\"; singleton:=\"true\"\n org.eclipse.core.filesystem [28]\n Unresolved requirement: Require-Capability: osgi.ee; filter:=\"(&(osgi.ee=JavaSE)(version=25))\"\n```\n\n### Screenshots or recordings / 截图或录屏\n\n未提供(已由上方脱敏诊断日志与 Equinox 堆栈完整覆盖)。\n\n### Checklist / 提交前检查\n\n- [x] I searched existing issues for duplicates. / 我已搜索现有 Issue,确认没有重复报告。\n- [x] I removed secrets and personal data from the report. / 我已从报告中移除敏感信息和个人数据。\n","author":{"url":"https://github.com/1lck","@type":"Person","name":"1lck"},"datePublished":"2026-11-17T07:01:52Z","url":"https://github.com/Lithe-IDEA/lithe-plugin-java/issues/27"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1a1fe17c-430a-35ec-49c7-6befe9f18421 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D9B6:15F7F4:3F8DC55:557A1BA:6B070DFE |
| html-safe-nonce | 2be2af54767e4f9d0a95fcfdacedc368f5544d5407b932783c21477d75ddc3c3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOUI2OjE1RjdGNDozRjhEQzU1OjU1N0ExQkE6NkIwNzBERkUiLCJ2aXNpdG9yX2lkIjoiNzM1ODU2NDA2ODQxODMyNjAxNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 139a098c34823794d74106db28fc99a1af0cfa9a31933ca3fcecd960f5977109 |
| hovercard-subject-tag | issue:6439300306 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/Lithe-IDEA/lithe-plugin-java/27/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bb495dd8468f5ecdc011a0127c735f899e22da99606a690ef756202f25b9ca56/Lithe-IDEA/lithe-plugin-java/issues/27 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bb495dd8468f5ecdc011a0127c735f899e22da99606a690ef756202f25b9ca56/Lithe-IDEA/lithe-plugin-java/issues/27 |
| og:image:alt | Platform / 平台 Windows Area / 模块 Language support / 语言服务 Lithe version / Lithe 版本 Lithe Desktop 0.8.1 + Java Support v3.0.1(Windows / macOS / Linux 均受影响) Priority / 优先级 P0 / 立即处理:已严重影响使用体验,核心流程受阻或无法... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | 1lck |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9aaa1abe1aaef39a8543ab08df7a776c3243275815d741d29afa7b02148ca05e |
| turbo-cache-control | no-preview |
| go-import | github.com/Lithe-IDEA/lithe-plugin-java git https://github.com/Lithe-IDEA/lithe-plugin-java.git |
| octolytics-dimension-user_id | 340144206 |
| octolytics-dimension-user_login | Lithe-IDEA |
| octolytics-dimension-repository_id | 1446370282 |
| octolytics-dimension-repository_nwo | Lithe-IDEA/lithe-plugin-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1446370282 |
| octolytics-dimension-repository_network_root_nwo | Lithe-IDEA/lithe-plugin-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 44c43783771de038e2c401dd343799000e8d1253 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width