oracle/graal · error · ValueError

Could not find the path to the java executable in: {jvm_cmd}

Error message

Could not find the path to the java executable in: {jvm_cmd}

What it means

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.

Source

Thrown at sdk/mx.sdk/mx_sdk_benchmark.py:4012

            return ["--cmd-app-prefix-init-sleep", "3"]

        def produceHarnessCommand(self, cmd, suite):
            """Maps a JVM command into a command tailored for the Barista harness.

            :param list[str] cmd: JVM command to be mapped.
            :param BaristaBenchmarkSuite suite: Barista benchmark suite running the benchmark on the Barista harness.
            :return: Command tailored for the Barista harness.
            :rtype: list[str]
            """
            if not isinstance(suite, BaristaBenchmarkSuite):
                raise TypeError(f"Expected an instance of {BaristaBenchmarkSuite.__name__}, instead got an instance of {suite.__class__.__name__}")
            jvm_cmd = cmd

            # Extract the path to the JVM distribution from the JVM command
            java_exe_pattern = os.path.join("^(.*)", "bin", "java$")
            java_exe_match = self._regexFindInCommand(jvm_cmd, java_exe_pattern)
            if not java_exe_match:
                raise ValueError(f"Could not find the path to the java executable in: {jvm_cmd}")

            # Extract VM options and command prefix from the JVM command
            index_of_java_exe = jvm_cmd.index(java_exe_match.group(0))
            jvm_cmd_prefix = jvm_cmd[:index_of_java_exe]
            jvm_vm_options = jvm_cmd[index_of_java_exe + 1:]

            # Verify that the run arguments don't already contain a "--mode" option
            run_args = suite.runArgs(bm_exec_context().get("bm_suite_args")) + self._energyTrackerExtraOptions(suite)
            mode_pattern = r"^(?:-m|--mode)(=.*)?$"
            mode_match = self._regexFindInCommand(run_args, mode_pattern)
            if mode_match:
                raise ValueError(f"You should not set the Barista '--mode' option manually! Found '{mode_match.group(0)}' in the run arguments!")

            # Get bench name and workload to use in the barista harness - we might have custom named benchmarks that need to be mapped
            barista_bench_name = suite.baristaHarnessBenchmarkName()
            barista_workload = suite.baristaHarnessBenchmarkWorkload()

            # Construct the Barista command

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Ensure the VM command handed to the Barista suite contains the plain JVM executable ending in bin/java.
  2. Remove custom launcher wrappers or JVM shims from --jvm-config/custom command overrides for Barista runs.
  3. On Windows, run under an environment where the JVM command is presented POSIX-style, or extend the pattern to accept bin/java(.exe).

Example fix

# before
mx benchmark barista:... -- --jvm-cmd=/path/bin/my-java-wrapper   # no bin/java token

# after
mx benchmark barista:... -- --jvm-cmd=/path/bin/java
Defensive patterns

Strategy: validation

Validate before calling

import os
assert any(t == "java" or t.endswith("/bin/java") for t in jvm_cmd if os.sep in t or t == "java"), (
    "VM command must contain a '.../bin/java' element for the Barista harness")

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14). Data as JSON: /api/errors/72a3d2551376d91b. Report an issue: GitHub.