{"record":{"id":"72a3d2551376d91b","repo":"oracle/graal","slug":"could-not-find-the-path-to-the-java-executable-in","errorCode":null,"errorMessage":"Could not find the path to the java executable in: {jvm_cmd}","messagePattern":"Could not find the path to the java executable in: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdk/mx.sdk/mx_sdk_benchmark.py","lineNumber":4012,"sourceCode":"            return [\"--cmd-app-prefix-init-sleep\", \"3\"]\n\n        def produceHarnessCommand(self, cmd, suite):\n            \"\"\"Maps a JVM command into a command tailored for the Barista harness.\n\n            :param list[str] cmd: JVM command to be mapped.\n            :param BaristaBenchmarkSuite suite: Barista benchmark suite running the benchmark on the Barista harness.\n            :return: Command tailored for the Barista harness.\n            :rtype: list[str]\n            \"\"\"\n            if not isinstance(suite, BaristaBenchmarkSuite):\n                raise TypeError(f\"Expected an instance of {BaristaBenchmarkSuite.__name__}, instead got an instance of {suite.__class__.__name__}\")\n            jvm_cmd = cmd\n\n            # Extract the path to the JVM distribution from the JVM command\n            java_exe_pattern = os.path.join(\"^(.*)\", \"bin\", \"java$\")\n            java_exe_match = self._regexFindInCommand(jvm_cmd, java_exe_pattern)\n            if not java_exe_match:\n                raise ValueError(f\"Could not find the path to the java executable in: {jvm_cmd}\")\n\n            # Extract VM options and command prefix from the JVM command\n            index_of_java_exe = jvm_cmd.index(java_exe_match.group(0))\n            jvm_cmd_prefix = jvm_cmd[:index_of_java_exe]\n            jvm_vm_options = jvm_cmd[index_of_java_exe + 1:]\n\n            # Verify that the run arguments don't already contain a \"--mode\" option\n            run_args = suite.runArgs(bm_exec_context().get(\"bm_suite_args\")) + self._energyTrackerExtraOptions(suite)\n            mode_pattern = r\"^(?:-m|--mode)(=.*)?$\"\n            mode_match = self._regexFindInCommand(run_args, mode_pattern)\n            if mode_match:\n                raise ValueError(f\"You should not set the Barista '--mode' option manually! Found '{mode_match.group(0)}' in the run arguments!\")\n\n            # Get bench name and workload to use in the barista harness - we might have custom named benchmarks that need to be mapped\n            barista_bench_name = suite.baristaHarnessBenchmarkName()\n            barista_workload = suite.baristaHarnessBenchmarkWorkload()\n\n            # Construct the Barista command","sourceCodeStart":3994,"sourceCodeEnd":4030,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/sdk/mx.sdk/mx_sdk_benchmark.py#L3994-L4030","documentation":"Barista's VM-command rewriting expects the JVM command to literally contain a '.../bin/java' element (regex '^(.*)/bin/java$' over command tokens). If the command uses java.exe on Windows, a wrapper script, or a differently named launcher, the match fails and ValueError is raised.","triggerScenarios":"Running Barista benchmarks on Windows (java.exe does not match 'bin/java'), through a custom launcher/wrapper, or with a VM command that invokes the JVM via a symlinked/renamed binary.","commonSituations":"Windows hosts; harnesses that prefix the command with env wrappers such that no token equals '.../bin/java'; GraalVM layouts where the launcher is 'bin/java' but the command rewrites it before Barista sees it.","solutions":["Ensure the VM command handed to the Barista suite contains the plain JVM executable ending in bin/java.","Remove custom launcher wrappers or JVM shims from --jvm-config/custom command overrides for Barista runs.","On Windows, run under an environment where the JVM command is presented POSIX-style, or extend the pattern to accept bin/java(.exe)."],"exampleFix":"# before\nmx benchmark barista:... -- --jvm-cmd=/path/bin/my-java-wrapper   # no bin/java token\n\n# after\nmx benchmark barista:... -- --jvm-cmd=/path/bin/java","handlingStrategy":"validation","validationCode":"import os\nassert any(t == \"java\" or t.endswith(\"/bin/java\") for t in jvm_cmd if os.sep in t or t == \"java\"), (\n    \"VM command must contain a '.../bin/java' element for the Barista harness\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass the plain JVM executable path ending in bin/java to Barista suites.","Avoid wrapper scripts or renamed launchers in --jvm-cmd for Barista runs.","On Windows, account for java.exe and pre-normalize or extend the matcher."],"tags":["graalvm","benchmark","barista","command-line","mx"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}