Skip to content

Java version detection for JDTLS installation fails #12120

@heoehmke

Description

@heoehmke

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

const m = /"(\d+)\.\d+\.\d+"/.exec(stderr.toString())

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions