matlab_jenv
Description
matlab_jenv
sets the Java® path for MATLAB® to a Java version on your system or the version in a specified folder. For supported version
information, see Versions of OpenJDK Compatible with MATLAB by Release. For more information, see
Configure Your System to Use Java.version
The matlab_jenv command does not start MATLAB. To use MATLAB, start MATLAB at the same system prompt where you set the path variable.
This command sets the path for all future MATLAB sessions but does not change the path for other applications on your computer.
matlab_jenv -clear removes
the JRE™ configuration for an individual user. Use this option after installing the
MATLAB Support for OpenJDK® add-on. (since R2026a)
When you clear the JRE configuration, MATLAB looks for the JRE in this order:
Location of the MATLAB Support for OpenJDK add-on.
Depending on your operating system:
For Windows® and Linux®, the version of Java shipped with MATLAB.
For Apple silicon, the system-installed Java.
matlab_jenv -allusers ___ updates the JRE configuration for all users of the MATLAB installation. Use this syntax with any of the input argument combinations in
previous syntaxes.
matlab_jenv -help displays command usage and syntax information
in the system prompt.
Examples
Input Arguments
Tips
To use the OpenJDK JRE, you can either install the MATLAB Support for OpenJDK add-on or download a compatible OpenJDK version from
https://adoptium.net.