oraios/serena · error · SolidLSPException

Could not parse Java version from '{java_exe}' output. Requi

Error message

Could not parse Java version from '{java_exe}' output. Required: JDK {JDTLS_MIN_JDK_VERSION}+. First lines of output: {output.strip().splitlines()[:5]}

What it means

SolidLSPException thrown by _inspect_java when a java.home was found but no 'version "<n>..."' line exists in the probe output, so the major version cannot be determined. JDTLS requires validating JDK 17+, and without a parseable version string the library cannot confirm compatibility.

Source

Thrown at src/solidlsp/language_servers/eclipse_jdtls.py:670

            except (OSError, subprocess.TimeoutExpired) as exc:
                raise SolidLSPException(f"Failed to run '{java_exe} -XshowSettings:properties -version': {exc}") from exc

            output = (result.stderr or "") + "\n" + (result.stdout or "")

            # parse java.home from "    java.home = /path/to/jdk"
            home_match = re.search(r"java\.home\s*=\s*(.+)", output)
            if not home_match:
                raise SolidLSPException(
                    f"Could not parse java.home from '{java_exe}' output. "
                    f"This usually means '{java_exe}' is not a valid JDK installation. "
                    f"First lines of output: {output.strip().splitlines()[:5]}"
                )
            real_home = home_match.group(1).strip()

            # parse major version from version line: 'openjdk version "21.0.2"' or 'java version "21.0.2"'
            version_match = re.search(r'version "(\d+)(?:\.\d+)*"', output)
            if not version_match:
                raise SolidLSPException(
                    f"Could not parse Java version from '{java_exe}' output. "
                    f"Required: JDK {JDTLS_MIN_JDK_VERSION}+. "
                    f"First lines of output: {output.strip().splitlines()[:5]}"
                )
            major = int(version_match.group(1))
            return real_home, major

        @classmethod
        def _compute_workspace_hash(
            cls,
            repository_root_path: str,
            jdtls_launcher_jar_path: str,
            custom_settings: SolidLSPSettings.CustomLSSettings,
        ) -> str:
            """
            Compute the JDTLS workspace directory name.

            The launcher jar path is mixed in so that switching JDTLS versions (default

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Run '<java_exe> -XshowSettings:properties -version' and check whether a standard 'openjdk version "..."' line appears
  2. Switch to a standard OpenJDK/Temurin distribution
  3. Reinstall the JDK if the version banner is missing
  4. Point java_home at a different, known-good JDK 17+ installation

Example fix

// before
$ java -version
custom-jvm: runtime ready  # no version line
// after
$ java -version
openjdk version "21.0.2" 2024-01-16
Defensive patterns

Strategy: validation

Validate before calling

import subprocess, re
def java_version_parseable(java_exe: str) -> bool:
    r = subprocess.run([java_exe, "-version"], capture_output=True, text=True, timeout=15)
    return bool(re.search(r'version "(\d+)(?:\.\d+)*"', (r.stderr or "") + (r.stdout or "")))

Type guard

def has_standard_version_banner(java_exe: str) -> bool:
    out = probe(java_exe)
    return re.search(r'(?:openjdk|java) version "\d+', out) is not None

Try / catch

try:
    ls = start_jdtls()
except SolidLSPException as e:
    if "Could not parse Java version" in str(e):
        switch_to_standard_openjdk()
        ls = start_jdtls()
    else:
        raise

Prevention

When it happens

Trigger: _resolve_system_jdk/_resolve_java -> _inspect_java where the regex 'version "(\d+)(?:\.\d+)*"' matches nothing in stderr+stdout, despite java.home parsing successfully.

Common situations: Custom JVM builds with altered -version output; output truncated by a pipe/buffer; tooling that filters or rewrites stderr; extremely exotic runtimes missing the standard version line.

Related errors


AI-assisted analysis of oraios/serena@7fcbca7e62 (2026-08-29). Data as JSON: /api/errors/e736e08ace6ed58a. Report an issue: GitHub.