{"record":{"id":"f6950e4c08968c95","repo":"SeleniumHQ/selenium","slug":"can-t-find-java-on-system-path-jre-is-required-to","errorCode":null,"errorMessage":"Can't find java on system PATH. JRE is required to run the Selenium server","messagePattern":"Can't find java on system PATH\\. JRE is required to run the Selenium server","errorType":"exception","errorClass":"OSError","httpStatus":null,"severity":"error","filePath":"py/selenium/webdriver/remote/server.py","lineNumber":189,"sourceCode":"\n        Latest version is downloaded unless specified.\n        \"\"\"\n        args = [\"--grid\"]\n        if version is not None:\n            args.append(version)\n        return SeleniumManager().binary_paths(args)[\"driver_path\"]\n\n    def start(self):\n        \"\"\"Start the server.\n\n        Selenium Manager will detect the server location and download it if necessary,\n        unless an existing server path was specified.\n        \"\"\"\n        path = self.download_if_needed(self.version) if self.path is None else self.path\n\n        java_path = self.java_path or shutil.which(\"java\")\n        if java_path is None:\n            raise OSError(\"Can't find java on system PATH. JRE is required to run the Selenium server\")\n\n        command = [\n            java_path,\n            \"-jar\",\n            path,\n            \"standalone\",\n            \"--port\",\n            str(self.port),\n            \"--log-level\",\n            self.log_level,\n            *self.args,\n        ]\n        if self.host is not None:\n            command.extend([\"--host\", self.host])\n\n        host = self.host if self.host is not None else \"localhost\"\n\n        try:","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/py/selenium/webdriver/remote/server.py#L171-L207","documentation":"Raised in `start()` when `self.java_path` is unset AND `shutil.which('java')` returns None, i.e. no `java` binary is discoverable on the system PATH. Running the Selenium server JAR requires a JRE, so without java the process cannot be built. It is an OSError.","triggerScenarios":"Calling `server.start()` on a host/container that has no JDK/JRE installed, or where java is installed but its bin directory is not on PATH. Also when PATH is overridden/reset in the spawned environment (env setter) to exclude java's location.","commonSituations":"Minimal Docker images (python:slim) with no JVM. CI runners where java is installed under a toolchain manager (sdkman/asdf) that hasn't been activated for the shell. SSH sessions with a trimmed PATH.","solutions":["Install a JRE/JDK (e.g. apt-get install -y default-jre, or a temurin image).","Ensure java's bin directory is on PATH: `which java` must succeed in the same shell.","Alternatively set server.java_path to an absolute java binary you have verified exists."],"exampleFix":"# before\n# (no java installed)\nserver.start()\n\n# after (Dockerfile)\n# RUN apt-get update && apt-get install -y default-jre-headless\nserver.start()","handlingStrategy":"validation","validationCode":"import shutil\nif server.java_path is None and shutil.which('java') is None:\n    raise EnvironmentError('java/JRE not installed or not on PATH; install a JRE before start()')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Bake a JRE into the deployment image rather than relying on the host.","Assert `shutil.which('java')` in a startup health check."],"tags":["environment","validation","dependencies","server-runner"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}