Java version detection for JDTLS installation fails #8514

Open
opened 2026-02-16 18:10:10 -05:00 by yindo · 0 comments
Owner

Originally created by @heoehmke on GitHub (Feb 4, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

The Java version detection for JDTLS fails when java -version outputs only the major version (e.g., "21") without minor/patch numbers. The regex
https://github.com/anomalyco/opencode/blob/af06175b1f293ea13d4165cee56db65fbbd56c65/packages/opencode/src/lsp/server.ts#L1144
expects a format like "21.0.0", causing the automatic JDTLS installation to fail with the error "JDTLS requires at least Java 21" even though Java 21 is installed:

openjdk version "21" 2023-09-19 LTS
OpenJDK Runtime Environment Temurin-21+35 (build 21+35-LTS)
OpenJDK 64-Bit Server VM Temurin-21+35 (build 21+35-LTS, mixed mode)

Plugins

No response

OpenCode version

1.1.51

Steps to reproduce

  1. Install Java 21 (e.g., Temurin-21+35) where java -version outputs "21" instead of "21.0.x"
  2. Open a Java project with opencode
  3. JDTLS fails to install with error "JDTLS requires at least Java 21"

Screenshot and/or share link

No response

Operating System

macOS 26.2

Terminal

No response

Originally created by @heoehmke on GitHub (Feb 4, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description The Java version detection for JDTLS fails when `java -version` outputs only the major version (e.g., "21") without minor/patch numbers. The regex https://github.com/anomalyco/opencode/blob/af06175b1f293ea13d4165cee56db65fbbd56c65/packages/opencode/src/lsp/server.ts#L1144 expects a format like "21.0.0", causing the automatic JDTLS installation to fail with the error "JDTLS requires at least Java 21" even though Java 21 is installed: ```shell openjdk version "21" 2023-09-19 LTS OpenJDK Runtime Environment Temurin-21+35 (build 21+35-LTS) OpenJDK 64-Bit Server VM Temurin-21+35 (build 21+35-LTS, mixed mode) ``` ### Plugins _No response_ ### OpenCode version 1.1.51 ### Steps to reproduce 1. Install Java 21 (e.g., Temurin-21+35) where `java -version` outputs "21" instead of "21.0.x" 2. Open a Java project with opencode 3. JDTLS fails to install with error "JDTLS requires at least Java 21" ### Screenshot and/or share link _No response_ ### Operating System macOS 26.2 ### Terminal _No response_
yindo added the bug label 2026-02-16 18:10:10 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8514