matlab-configure-java

Installation
SKILL.md

Configure the MATLAB Java Runtime

Configure the MATLAB Java runtime by using jenv and matlab_jenv. For example, install OpenJDK after a java.* API failure, or select and switch to a specific JDK. The load status determines whether MATLAB requires a restart.

When to Use

  • A MATLAB script errors on a java.* API call with "no runtime environment for Java applications has been found" (R2026a and later) or "Unable to find Java library" (R2025a, R2025b). Error text often includes a link to mathworks.com/matlab-openjdk.
  • User asks "which Java version is my MATLAB session using?" or wants to check the current MATLAB Java configuration. This is a read-only question: answer it with jenv alone (see Branch B step 1).
  • User wants to switch MATLAB to a specific Java version — "point MATLAB at the JDK at /path", "change Java version used by MATLAB", "switch MATLAB to Java 21".
  • User wants to reset the MATLAB Java to the default. The reset command depends on release and platform (Branch B step 4).

When NOT to Use

If the user's request is about Java tooling outside MATLAB — compiling source with javac, building JARs, IDE Java configuration, OS-level JAVA_HOME for the terminal shell, or any other non-MATLAB Java toolchain — this skill does not apply. Exit silently with a minimal redirect: state briefly that the question is outside MATLAB Java-runtime setup, and point to general JDK / Java-toolchain documentation. Do NOT name jenv, matlab_jenv, MATLAB_JAVA, Adoptium, the Add-Ons Explorer, mathworks.com/matlab-openjdk, or any other mechanism from this skill — not even to disclaim them, and not in an "if you meant X instead" offer. Naming the tools of this skill in a response to a javac prompt implies MATLAB is involved even though it is not, which confuses the user rather than helping.

The javac boundary is the most-commonly-confused adjacent topic. If a prompt matches either of these shapes, treat it as out of scope:

  • "How do I compile my Java code / class / program with javac?"
  • "How do I build a JAR / set up a Java project / configure my Java IDE?"
Installs
8
GitHub Stars
1.4K
First Seen
Nov 13, 2026