slint-ui/slint · error

Could not run the java compiler

Error message

Could not run the java compiler: {e}

What it means

The javac command was constructed but executing it (via `.output()`) failed, meaning the process could not be spawned or run to completion. The build script panics with this message, distinguishing an execution failure (e.g. javac binary vanished, exec permission, IO error) from a compilation error (error 39).

Solutions

  1. Confirm javac at the resolved path is executable (`ls -l $(command -v javac)`, chmod +x if needed)
  2. Reinstall/repair the JDK if the binary is missing or corrupted
  3. Raise process/memory limits in the CI environment if spawn fails from resource exhaustion
  4. Run the same javac command manually to see the underlying OS error

Example fix

// before
javac: Permission denied
// after
chmod +x $JAVA_HOME/bin/javac && cargo build
Defensive patterns

Strategy: validation

Validate before calling

import subprocess, shutil
javac = shutil.which("javac")
assert javac and os.access(javac, os.X_OK), "javac missing or not executable"
subprocess.run([javac, "-version"], check=True, capture_output=True)

Prevention

When it happens

Trigger: `Command::output()` on the javac command returns Err — javac not executable, binary removed between discovery and spawn, OOM-killer or IO failure during execution.

Common situations: Partially installed or broken JDK; environment sanitization removing PATH to the tool binary; resource limits (ulimit, cgroup OOM) killing process spawn in CI.

Related errors


AI-assisted analysis of slint-ui/slint@bb937076de (2026-09-16). Data as JSON: /api/errors/45e96c9be24d2733. Report an issue: GitHub.

Appendix: source

Thrown at internal/backends/android-activity/build.rs:52

    let android_jar = android_build::android_jar(None).expect("No Android platforms found");

    // Compile the Java file into .class files
    let o = JavaBuild::new()
        .file(&java_src_path)
        .class_path(&android_jar)
        .classes_out_dir(&out_class_dir)
        .java_source_version(8)
        .java_target_version(8)
        .debug_info(android_build::DebugInfo {
            line_numbers: !release_mode,
            variables: !release_mode,
            source_files: !release_mode,
        })
        .command()
        .unwrap_or_else(|e| panic!("Could not generate the java compiler command: {e}"))
        .args(["-encoding", "UTF-8"])
        .output()
        .unwrap_or_else(|e| panic!("Could not run the java compiler: {e}"));

    if !o.status.success() {
        panic!("Java compilation failed: {}", String::from_utf8_lossy(&o.stderr));
    }

    let o = Dexer::new()
        .android_jar(&android_jar)
        .class_path(&out_class_dir)
        .collect_classes(&out_class_dir)
        .unwrap()
        .release(release_mode)
        .android_min_api(20) // disable multidex for single dex file output
        .out_dir(out_dir)
        .command()
        .unwrap_or_else(|e| panic!("Could not generate the D8 command: {e}"))
        .output()
        .unwrap_or_else(|e| panic!("Error running D8: {e}"));

View on GitHub (pinned to bb937076de)