Main Content

jenv

Set JRE Java Runtime Environment path for MATLAB

    Description

    example

    jenv version sets the JRE™ path to use the default version on your system or to use the version shipped with MATLAB®. You must restart MATLAB to use the updated path.

    This command sets the path for all future MATLAB sessions but does not change the path for other applications on you computer.

    example

    jenv jrePath sets the path to a specific folder.

    example

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

    Examples

    collapse all

    jenv factory
    

    Restart MATLAB.

    Verify the version.

    version -java

    Use the version of the JRE installed at C:\Program Files\Java\jre8.

    jenv("C:\Program Files\Java\jre1.8.0_202")
    

    Restart MATLAB.

    Verify the version.

    version -java

    If you have administrator privileges, you can specify the JRE used by all users.

    Start MATLAB with administrator privileges.

    jenv -allusers system
    

    Restart MATLAB.

    Verify the version.

    version -java

    Input Arguments

    collapse all

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

    Example: jenv system

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

    Example: jenv C:\Custom\Java\bin

    See Also

    Introduced in R2021b