{"record":{"id":"70cf21bbf198354b","repo":"apache/beam","slug":"java-is-not-correctly-installed-in-java-home-s-to-use-this","errorCode":null,"errorMessage":"Java is not correctly installed in JAVA_HOME=%s to use this transform/runner. Please check if JAVA_HOME is correctly set and points to your Java installation directory.","messagePattern":"Java is not correctly installed in JAVA_HOME=(.+?) to use this transform/runner\\. Please check if JAVA_HOME is correctly set and points to your Java installation directory\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/utils/subprocess_server.py","lineNumber":384,"sourceCode":"    if classpath:\n      # java -jar ignores the classpath, so we make a new jar that embeds\n      # the requested classpath.\n      path_to_jar = self.make_classpath_jar(path_to_jar, classpath, cache_dir)\n    super().__init__(\n        stub_class,\n        [self._java_path, '-jar', path_to_jar] + list(java_arguments),\n        logger=logger)\n    self._existing_service = path_to_jar if is_service_endpoint(\n        path_to_jar) else None\n\n  def start_process(self):\n    if self._existing_service:\n      return None, self._existing_service\n    else:\n      if not shutil.which(self._java_path):\n        java_home = os.environ.get('JAVA_HOME')\n        if java_home:\n          raise RuntimeError(\n              'Java is not correctly installed in JAVA_HOME=%s to use this '\n              'transform/runner. Please check if JAVA_HOME is correctly set and'\n              ' points to your Java installation directory.' % java_home)\n        else:\n          raise RuntimeError(\n              'Java must be installed on this system to use this '\n              'transform/runner.')\n      return super().start_process()\n\n  def stop_process(self):\n    if self._existing_service:\n      pass\n    else:\n      return super().stop_process()\n\n  @classmethod\n  def jar_name(cls, artifact_id, version, classifier=None, appendix=None):\n    return '-'.join(","sourceCodeStart":366,"sourceCodeEnd":402,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/utils/subprocess_server.py#L366-L402","documentation":"JavaJarServer.start_process() checks that the java executable (java_path, typically from JAVA_HOME) exists via shutil.which before spawning the job server. If which() fails but JAVA_HOME is set, it raises this error telling you JAVA_HOME does not point to a valid Java installation.","triggerScenarios":"Calling any runner/transform that launches a Java subprocess (FlinkRunner, SparkRunner, expansion service, job server) while JAVA_HOME is set but $JAVA_HOME/bin/java does not exist or is not executable.","commonSituations":"JAVA_HOME pointing to a JRE-only directory, a deleted/upgraded JDK path, a typo like /usr/lib/jvm/java (missing version), or an exploded/unpacked JDK missing bin/java; docker images where JAVA_HOME env var was set but the JDK was removed.","solutions":["Verify $JAVA_HOME/bin/java exists and runs: run '$JAVA_HOME/bin/java -version'.","Correct JAVA_HOME in your shell/profile to the real JDK root (e.g. /usr/lib/jvm/java-17-openjdk-amd64).","Install a full JDK (not just JRE) at the JAVA_HOME path.","Unset JAVA_HOME so Beam falls back to java on PATH, if PATH has a valid java."],"exampleFix":"// before\nexport JAVA_HOME=/usr/lib/jvm/java  # directory does not contain bin/java\n// after\nexport JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64\nexport PATH=$JAVA_HOME/bin:$PATH","handlingStrategy":"validation","validationCode":"import os, shutil\njh = os.environ.get('JAVA_HOME')\nif jh and not shutil.which(os.path.join(jh, 'bin', 'java')):\n    raise SystemExit(f'JAVA_HOME={jh} has no bin/java; fix before starting')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate JAVA_HOME/bin/java exists in CI before pipeline runs","Always install full JDK, not JRE-only images","After JDK upgrades, re-derive JAVA_HOME","Test with 'java -version' in the same shell that runs Beam"],"tags":["python","java","environment","configuration","apache-beam"],"backgroundTag":"missing-env-var","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}