jenv
Description
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)
This function sets the path for all future MATLAB sessions but does not change the path for other applications on your computer.
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.
jenv("-allusers",___) configures the JRE for all users of a MATLAB installation. Use this syntax with any of the input argument combinations
in previous syntaxes.
je = jenv returns information about the current Java environment as a JavaEnvironment
object.
je = jenv(___) returns information about the
Java environment after making the specified Java configuration changes. Use this syntax with any of the input argument
combinations in previous syntaxes.
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.