oraios/serena · error

Java {BSL_LS_MIN_JAVA_VERSION}+ is required for BSL Language

Error message

Java {BSL_LS_MIN_JAVA_VERSION}+ is required for BSL Language Server but 'java' was not found on PATH.

What it means

_verify_java_available raises RuntimeError when no `java` executable is found on PATH. BSL Language Server is a Java application, so the library verifies a suitable Java (>= BSLS_MIN_JAVA_VERSION) exists before constructing the launch command.

Source

Thrown at src/solidlsp/language_servers/bsl_language_server.py:86

    m = re.search(r'version "(\d+)(?:\.(\d+))?', output)
    if not m:
        log.warning("Could not parse Java version from output of '%s -version': %s", java_exe, output.strip()[:200])
        return None

    first = int(m.group(1))
    if first == 1 and m.group(2):
        return int(m.group(2))  # 1.8 -> 8
    return first


def _verify_java_available() -> None:
    """Ensures a suitable ``java`` (>= :data:`BSL_LS_MIN_JAVA_VERSION`) is on ``PATH``.

    :raises RuntimeError: if ``java`` is missing or its major version is too low.
    """
    java_exe = shutil.which("java")
    if java_exe is None:
        raise RuntimeError(f"Java {BSL_LS_MIN_JAVA_VERSION}+ is required for BSL Language Server but 'java' was not found on PATH.")

    major = _get_java_major_version(java_exe)
    if major is None:
        # detection failed; log a warning but let the LSP attempt to start
        log.warning("Could not determine Java version for '%s'; BSL LSP requires Java %d+.", java_exe, BSL_LS_MIN_JAVA_VERSION)
        return

    if major < BSL_LS_MIN_JAVA_VERSION:
        raise RuntimeError(
            f"Java {BSL_LS_MIN_JAVA_VERSION}+ is required for BSL Language Server, but '{java_exe}' is Java {major}. "
            f"Install a newer JDK (e.g. Temurin {BSL_LS_MIN_JAVA_VERSION}) and ensure it appears first on PATH "
            f"or point JAVA_HOME to it."
        )


class BSLLanguageServer(SolidLanguageServer):
    """
    BSL (1C:Enterprise / OneScript) language server integration for Serena.

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Install a JDK of at least the minimum version (e.g. Temurin BSLS_MIN_JAVA_VERSION)
  2. Ensure the java binary's directory is on PATH for the process launching the language server
  3. Set JAVA_HOME and add $JAVA_HOME/bin to PATH in the launch environment
  4. Verify with `which java && java -version` in the same environment that runs the server

Example fix

// before
# java not installed
serena...  # RuntimeError: Java 17+ is required...
// after
sudo apt-get install -y openjdk-17-jdk
export PATH=/usr/lib/jvm/java-17-openjdk/bin:$PATH
Defensive patterns

Strategy: validation

Validate before calling

import shutil, subprocess
if shutil.which("java") is None:
    raise SystemExit("Install JDK 17+ (e.g. Temurin) and ensure 'java' is on PATH before starting the BSL language server")

Try / catch

try:
    server = BSLLanguageServer(...)
except RuntimeError as e:
    if "was not found on PATH" in str(e):
        install_or_locate_jdk()  # set JAVA_HOME / PATH then retry
    else:
        raise

Prevention

When it happens

Trigger: Calling _create_launch_command (during BSL language server startup) when shutil.which('java') returns None — i.e. no java binary resolvable via PATH in the process environment.

Common situations: Java/JDK not installed; JAVA installed but not on PATH for the process running Serena (IDE launch env vs shell env); running in a slim Docker image without a JRE; using a JRE-managed toolchain (e.g. sdkman/jenv) not initialized in the server process.

Related errors


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