oraios/serena · error · SolidLSPException
Could not parse java.home from '{java_exe}' output. This usu
Error message
Could not parse java.home from '{java_exe}' output. This usually means '{java_exe}' is not a valid JDK installation. First lines of output: {output.strip().splitlines()[:5]} What it means
SolidLSPException thrown by _inspect_java when the output of 'java -XshowSettings:properties -version' contains no 'java.home = ...' line. This normally means the executable is not a real JDK/JVM, so the library cannot determine the true JDK home and aborts rather than guessing.
Source
Thrown at src/solidlsp/language_servers/eclipse_jdtls.py:660
"""
try:
# both -XshowSettings:properties and -version write to stderr by convention
result = subprocess_run(
[java_exe, "-XshowSettings:properties", "-version"],
capture_output=True,
text=True,
timeout=15,
check=False,
)
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
@classmethodView on GitHub (pinned to 7fcbca7e62)
Solutions
- Run '<java_exe> -XshowSettings:properties -version' manually and inspect the output
- Replace the shim/stub with a real JDK and update java_home/JAVA_HOME accordingly
- Reinstall the JDK if its output is corrupted
- Set ls_specific_settings.java.java_home directly to a known-good JDK home to bypass PATH discovery
Example fix
// before $ which java /usr/bin/java # distro stub that prints 'no java runtime present' // after java_home: /usr/lib/jvm/temurin-21-jdk-amd64 # real JDK home
Defensive patterns
Strategy: validation
Validate before calling
import subprocess, re
def java_home_parseable(java_exe: str) -> bool:
r = subprocess.run([java_exe, "-XshowSettings:properties", "-version"],
capture_output=True, text=True, timeout=15)
return bool(re.search(r"java\.home\s*=\s*(.+)", (r.stderr or "") + (r.stdout or ""))) Type guard
def looks_like_real_jvm(java_exe: str) -> bool:
out = probe(java_exe) # stderr+stdout of -XshowSettings:properties -version
return "java.home" in out and "java.version" in out Try / catch
try:
ls = start_jdtls()
except SolidLSPException as e:
if "Could not parse java.home" in str(e):
replace_stub_with_real_jdk() # e.g. install temurin-21 and set java_home
ls = start_jdtls()
else:
raise Prevention
- Avoid shims/wrappers (sdkman, jabba, distro stubs) on PATH for service accounts
- Set java_home explicitly to a real JDK home to bypass PATH discovery
- On minimal Linux images, install a real JRE/JDK rather than relying on /usr/bin/java stub
- Inspect the first output lines included in the error to identify the culprit binary
When it happens
Trigger: _resolve_system_jdk/_resolve_java -> _inspect_java where the combined stderr+stdout lacks a java.home property line - e.g. the 'java' resolved is a wrapper script, a JDK uninstaller stub, or prints unrelated text.
Common situations: PATH 'java' is a shim (sdkman/jabba wrapper misconfigured); a dummy stub binary like /usr/bin/java on minimal Linux without a real JVM; output locale/format changes breaking expectations; antivirus truncating output.
Related errors
- Could not parse Java version from '{java_exe}' output. Requi
- Failed to run '{java_exe} -XshowSettings:properties -version
- Java {BSL_LS_MIN_JAVA_VERSION}+ is required for BSL Language
- Java {BSL_LS_MIN_JAVA_VERSION}+ is required for BSL Language
- BSL Language Server JAR not found at {jar_path} after instal
AI-assisted analysis of oraios/serena@7fcbca7e62 (2026-08-29).
Data as JSON: /api/errors/7950308509090446.
Report an issue: GitHub.