Repository navigation
Description
1. mxcli version: nightly-20261111-0036eef98 (Windows 11, amd64)
2. Mendix version: 11.12.6
Repro app: a fresh mxcli new app, built by the script below
3. Scenario
On a Windows machine with a JRE 21 and a JDK 21 installed side by side (Eclipse Adoptium jre-21.0.5.11-hotspot and jdk-21.0.2.13-hotspot) and JAVA_HOME unset, mxcli test --local and mxcli run --local hand the JRE to MxBuild. The build then fails with Gradle's "Java compiler is not available". Studio Pro on the same machine is configured with the JDK and builds fine, so nothing prompts the developer to set JAVA_HOME until the first local test run fails. Related to #1437 (wrong JDK version for a Mendix 9 app), but here the problem is that a JRE is chosen over a JDK.
Self-contained repro, run in an empty directory:
#!/usr/bin/env bash
# Repro: with a JRE 21 and a JDK 21 side by side and JAVA_HOME unset, `mxcli test --local`
# builds with the JRE and MxBuild cannot compile Java actions.
# Needs mxcli on Windows with Eclipse Adoptium jre-21.0.5.11-hotspot and jdk-21.0.2.13-hotspot installed.
set -e
cd "$(dirname "$0")"
export MXCLI_LOG_DIR="$PWD/logs" # own log dir: the diag only contains this repro
P=Repro/Repro.mpr
unset JAVA_HOME
ls "/c/Program Files/Eclipse Adoptium/"
mxcli new Repro --version 11.12.6 --skip-build > /dev/null
mkdir -p tmp; export TMP="$(cygpath -w "$PWD/tmp")" TEMP="$(cygpath -w "$PWD/tmp")" # mxcli test's temp scripts stay in this dir
mkdir -p tests
cat > tests/smoke.test.mdl <<'MDL'
mdl 1;
/**
* @test The test chain works
* @expect $Out = true
*/
declare $Out boolean = true;
MDL
echo "== 1. JAVA_HOME unset"
mxcli test tests/smoke.test.mdl -p $P --local --db-type hsqldb --skip-app-startup --require-assertions 2>&1 | tail -12 || true
echo "== 2. JAVA_HOME on the JDK"
JAVA_HOME='C:\Program Files\Eclipse Adoptium\jdk-21.0.2.13-hotspot' \
mxcli test tests/smoke.test.mdl -p $P --local --db-type hsqldb --skip-app-startup --require-assertions 2>&1 | tail -6Output (progress lines of mxcli new left out):
jdk-21.0.2.13-hotspot
jre-21.0.5.11-hotspot
== 1. JAVA_HOME unset
"problems": {
"errors": [
{
"message": "An error occurred while compiling Java actions",
"details": "\r\nFAILURE: Build failed with an exception.\r\n\r\n* What went wrong:\r\nExecution failed for task ':compile'.\r\n> Java compiler is not available. Please check that C:\\Program Files\\Eclipse Adoptium\\jre-21.0.5.11-hotspot contains a valid JDK installation.\r\n\r\n* Try:\r\n> Run with --stacktrace option to get the stack trace.\r\n> Run with --debug option to get more log output.\r\n> Run with --scan to get full insights.\r\n> Get more help at https://help.gradle.org.\r\n\r\nBUILD FAILED in 4s\r\n"
}
],
"problems": []
},
"status": "Failure",
"message": "An error occurred while compiling Java actions"
}
== 2. JAVA_HOME on the JDK
Test Results: smoke
============================================================
PASS The test chain works (12ms, 1 assertion)
------------------------------------------------------------
Total: 1 Passed: 1 Failed: 0 Skipped: 0 Time: 18ms
All tests passed.
4. Expected output
- When resolving a JDK, mxcli skips installations without a compiler (no
bin/javac.exe), so the JDK 21 is used even though the JRE 21 has a higher patch version. Using the JDK directory Studio Pro has configured for that Mendix version would also fix it. - Until then: fail before injecting the test module and starting MxBuild, with a message that names the chosen directory, says it is a JRE, and suggests
JAVA_HOME.
5. Experienced output
| Expected | Actual | |
|---|---|---|
Java handed to MxBuild, JAVA_HOME unset |
jdk-21.0.2.13-hotspot |
jre-21.0.5.11-hotspot |
mxcli test --local |
1 passed | build fails: "Java compiler is not available" |
mxcli test --local with JAVA_HOME on the JDK |
1 passed | 1 passed |
Other spellings tried
mxcli run --local --db-type hsqldb --detach -p Repro/Repro.mpr→ same Gradle error;mxcli run status→stopped: boot failed — initial build failed: An error occurred while compiling Java actions (log Repro\.mxcli\run.log)mxcli help runandmxcli help testlist no--java-homeor--jdkoption; settingJAVA_HOMEis the only way to choose the JDK.
6. AI bug report
mxcli diag of the repro run:
Version: nightly-20261111-0036eef98
Go: go1.27.3 windows/amd64
Sessions: 23 (last 7 days)
Errors: 2 (last 7 days)
Session log of both mxcli test runs (the first with JAVA_HOME unset, the second with JAVA_HOME on the JDK), from mxcli diag --bundle:
{"time":"2026-11-12T13:55:17.1580739+01:00","level":"INFO","msg":"session_start","version":"nightly-20261111-0036eef98","go":"go1.27.3","os":"windows","arch":"amd64","mode":"mxcli test","args":["mxcli","test","tests/smoke.test.mdl","-p","Repro/Repro.mpr","--local","--db-type","hsqldb","--skip-app-startup","--require-assertions"],"pid":25904,"parent_pid":""}
{"time":"2026-11-12T13:56:24.4260728+01:00","level":"INFO","msg":"session_start","version":"nightly-20261111-0036eef98","go":"go1.27.3","os":"windows","arch":"amd64","mode":"mxcli test","args":["mxcli","test","tests/smoke.test.mdl","-p","Repro/Repro.mpr","--local","--db-type","hsqldb","--skip-app-startup","--require-assertions"],"pid":29808,"parent_pid":""}
The log only records session_start for both runs: neither the Java installation mxcli resolved nor the build failure ends up in the session log. (The 2 errors in the diag summary are show microflows in MxTest lookups before the test module exists, not this failure.)
Why it matters
On Windows a JRE often sits next to the JDK, and the JRE is often the newer one because it is updated separately. Studio Pro uses its own configured JDK, so JAVA_HOME is usually not set. The first mxcli test --local or run --local then fails after injecting the test module and starting MxBuild, with a Gradle message that does not mention mxcli's Java choice. Workaround: set JAVA_HOME to the JDK, either per run or as a user environment variable.
Activity