oracle/graal · error · AssertionError
Could not execute {jdk.java}
Error message
Could not execute {jdk.java} What it means
mx probes the JDK for JVMCI support by running 'java -XX:+UnlockExperimentalVMOptions -XX:+PrintFlagsFinal -version'. A non-zero return code (java not executable, broken JDK, or unsupported flags) causes AssertionError 'Could not execute <java path>'.
Source
Thrown at sdk/mx.sdk/mx_sdk_vm.py:600
_base_jdk_final = _base_jdk_stage1
return _base_jdk_final
def base_jdk_version(stage1=True):
return base_jdk(stage1=stage1).javaCompliance.value
def get_jdk_version_for_profiles():
jdk_version = mx.get_jdk().javaCompliance.value
return '_LATEST' if jdk_version > 21 else jdk_version
def _probe_jvmci_info(jdk, attribute_name):
if not hasattr(jdk, '.enables_jvmci_by_default'):
out = mx.LinesOutputCapture()
def sink(x):
return x
rc = mx.run([jdk.java, '-XX:+UnlockExperimentalVMOptions', '-XX:+PrintFlagsFinal', '-version'], out=out, err=sink, nonZeroIsFatal=False)
if rc != 0:
raise AssertionError(f"Could not execute {jdk.java}")
enableJVMCI = False
jvmciThreadsPerNativeLibraryRuntime = None
for line in out.lines:
if 'EnableJVMCI' in line and 'true' in line:
enableJVMCI = True
if 'JVMCIThreadsPerNativeLibraryRuntime' in line:
m = re.search(r'JVMCIThreadsPerNativeLibraryRuntime *= *(\d+)', line)
if not m:
mx.abort(f'Could not extract value of JVMCIThreadsPerNativeLibraryRuntime from "{line}"')
jvmciThreadsPerNativeLibraryRuntime = int(m.group(1))
setattr(jdk, '.enables_jvmci_by_default', enableJVMCI)
setattr(jdk, '.jvmciThreadsPerNativeLibraryRuntime', jvmciThreadsPerNativeLibraryRuntime)
return getattr(jdk, attribute_name)
def jdk_enables_jvmci_by_default(jdk):
"""
Gets the default value for the EnableJVMCI VM option in `jdk`.
"""View on GitHub (pinned to a66e9ccd1d)
Solutions
- Run the probe command manually with the reported path: <jdk>/bin/java -XX:+UnlockExperimentalVMOptions -XX:+PrintFlagsFinal -version, and read its error.
- Fix or reinstall the JDK, or point mx at a valid JDK via --java-home/JAVA_HOME (a full JDK, not a JRE).
- Use a GraalVM-supported JDK version so the experimental flags exist.
Example fix
# before export JAVA_HOME=/opt/jre11 # probe fails -> AssertionError # after export JAVA_HOME=/opt/jdk21 mx --java-home=/opt/jdk21 build
Defensive patterns
Strategy: validation
Validate before calling
import subprocess, os
java = os.path.join(jdk_path, "bin", "java")
rc = subprocess.run([java, "-XX:+UnlockExperimentalVMOptions", "-XX:+PrintFlagsFinal", "-version"]).returncode
assert rc == 0, f"JDK probe failed (rc={rc}); fix or replace the JDK at {jdk_path}" Prevention
- Point mx at a full JDK (not a JRE) of a supported version via --java-home.
- Smoke-test 'java -version' plus the probe flags when provisioning CI images or docker containers.
- Re-run mx suite commands in a fresh shell after switching JDKs to avoid stale probe caches.
When it happens
Trigger: JAVA_HOME/jdk set to a broken, partial, or non-JVMCI-aware JDK; the java binary missing execute permission; a JDK too old/new such that the probe flags are rejected.
Common situations: Pointing mx at a JRE instead of a full JDK; truncated JDK extraction; docker images with a stripped java; switching JDKs mid-session with stale cached probe results.
Related errors
- Set the JVMCI_VERSION_CHECK environment variable to "ignore"
- Unexpected OS name: %s
- Neither {daCapoClasspathEnvVarName} variable nor {daCapoLibr
- The SPECJVM2008 environment variable was not specified.
- The SPECJBB2015 environment variable was not specified.
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/def92e91a52a0e3b.
Report an issue: GitHub.