{"record":{"id":"339a6a9576ad00fc","repo":"oraios/serena","slug":"could-not-locate-a-java-installation-for-the-nextf","errorCode":null,"errorMessage":"Could not locate a Java installation for the Nextflow language server. Set ls_specific_settings.nextflow.java_home, set the JAVA_HOME environment variable, or ensure 'java' is on PATH. Required: JDK 17+.","messagePattern":"Could not locate a Java installation for the Nextflow language server\\. Set ls_specific_settings\\.nextflow\\.java_home, set the JAVA_HOME environment variable, or ensure 'java' is on PATH\\. Required: JDK 17\\+\\.","errorType":"exception","errorClass":"SolidLSPException","httpStatus":null,"severity":"error","filePath":"src/solidlsp/language_servers/nextflow_language_server.py","lineNumber":163,"sourceCode":"            java_exe: str | None = None\n            if explicit_home := self._custom_settings.get(\"java_home\"):\n                candidate = str(Path(explicit_home) / \"bin\" / java_exe_name)\n                if not os.path.exists(candidate):\n                    raise SolidLSPException(\n                        f\"java_home='{explicit_home}' is invalid: '{candidate}' does not exist. \"\n                        f\"Set ls_specific_settings.nextflow.java_home to a JDK home that contains bin/{java_exe_name}.\"\n                    )\n                java_exe = candidate\n            elif env_home := os.environ.get(\"JAVA_HOME\"):\n                candidate = str(Path(env_home) / \"bin\" / java_exe_name)\n                if os.path.exists(candidate):\n                    java_exe = candidate\n                else:\n                    log.warning(\"JAVA_HOME='%s' invalid (no '%s'), falling back to PATH.\", env_home, candidate)\n            if java_exe is None:\n                java_exe = shutil.which(\"java\")\n            if java_exe is None:\n                raise SolidLSPException(\n                    \"Could not locate a Java installation for the Nextflow language server. \"\n                    \"Set ls_specific_settings.nextflow.java_home, set the JAVA_HOME environment variable, \"\n                    f\"or ensure 'java' is on PATH. Required: JDK {MIN_JDK_VERSION}+.\"\n                )\n\n            # reuse JDTLS's JVM interrogation, which reports the real java.home even for stub launchers\n            from solidlsp.language_servers.eclipse_jdtls import EclipseJDTLS\n\n            java_home, major_version = EclipseJDTLS.DependencyProvider._inspect_java(java_exe)\n            if major_version < MIN_JDK_VERSION:\n                raise SolidLSPException(\n                    f\"The Nextflow language server requires JDK {MIN_JDK_VERSION}+ but '{java_exe}' is JDK {major_version} \"\n                    f\"(java.home={java_home}). Install a newer JDK and update ls_specific_settings.nextflow.java_home \"\n                    \"or JAVA_HOME.\"\n                )\n            log.info(\"Using JDK %d at %s for the Nextflow language server\", major_version, java_exe)\n            return java_exe\n","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/solidlsp/language_servers/nextflow_language_server.py#L145-L181","documentation":"_resolve_java tries three sources for a Java executable in order: the explicit java_home setting, the JAVA_HOME environment variable, and 'java' on PATH. If none yields a usable executable, SolidLSPException is thrown telling the user every option for providing a JDK 17+.","triggerScenarios":"Starting the Nextflow language server when ls_specific_settings.nextflow.java_home is unset, JAVA_HOME is unset (or its bin/java is missing, causing a logged fallback), and shutil.which(\"java\") finds nothing.","commonSituations":"Docker/CI containers with no JDK installed; headless servers without Java; python venvs where PATH is minimal; JAVA_HOME set to a corrupted install whose bin/java was deleted.","solutions":["Install JDK 17+ (e.g. apt install openjdk-17-jdk, brew install openjdk@17) and ensure java is on PATH.","Set the JAVA_HOME environment variable to the JDK home directory.","Set ls_specific_settings.nextflow.java_home to a valid JDK home containing bin/java."],"exampleFix":"// before\n# no java configured, server fails to start\n// after\nexport JAVA_HOME=/usr/lib/jvm/jdk-17\nexport PATH=\"$JAVA_HOME/bin:$PATH\"","handlingStrategy":"validation","validationCode":"import shutil\n\ndef java_available():\n    return bool(shutil.which(\"java\")) or bool(os.environ.get(\"JAVA_HOME\"))","typeGuard":null,"tryCatchPattern":"from solidlsp import SolidLSPException\ntry:\n    server = NextflowLanguageServer(...)\nexcept SolidLSPException as e:\n    logger.error(\"No JDK found: %s\", e)\n    raise SystemExit(\"Install JDK 17+ and set JAVA_HOME\")","preventionTips":["Install a JDK 17+ in Docker/CI images before running the server.","Set JAVA_HOME in shell profiles and CI environment blocks.","Smoke-test with `java -version` in the same environment the server runs in."],"tags":["java","missing-dependency","nextflow","language-server"],"backgroundTag":"missing-java-runtime","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}