Main Content


Set JRE Java Runtime Environment path for MATLAB from system prompt


matlab_jenv version sets the JRE™ path to use the default version on your system or to use the version shipped with MATLAB®.

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 you computer.

matlab_jenv jrePath sets the path to a specific folder.


matlab_jenv -allusers ___ sets the path for all users, using any of the previous syntaxes.

matlab_jenv -help displays the syntax.


expand all

After installing MATLAB, a system administrator can set the JRE path for all users.

Use the system value for the installed MATLAB. With administrative privileges, at the operating system prompt, type:

matlab_jenv -allusers system

Verify the version. Start MATLAB and type:

version -java

Input Arguments

expand all

JRE version, specified as system to use the default version on the system or factory to use the version shipped with MATLAB.

Example: matlab_jenv system

JRE path, specified as a string or a character vector, wherejrePath is a folder to an installed JRE this computer.

matlab_jenv C:\Custom\Java\bin

See Also

Introduced in R2021b