Configure Your System to Use Java
To call Java® library functionality from MATLAB®, you must have a supported version of the Java Runtime Environment (JRE™) software installed on your system. For supported version information, see MATLAB Interfaces to Other Languages.
To find out what Java version MATLAB uses on your system, call the jenv
function.
Oracle Java Configuration
When you install MATLAB, MATLAB is configured to use Oracle® version 8 JVM™.
If you prefer to use a different JRE, follow the instructions in OpenJDK Java Configuration.
OpenJDK Java Configuration
MATLAB supports OpenJDK® Java versions 8 and 11. To use the OpenJDK JDK™ or JRE:
Download and install OpenJDK Java 8 or 11 from
https://adoptium.net/
.If OpenJDK is the first Java entry on your system path, then to configure MATLAB, type:
jenv("system")
If OpenJDK is not the first entry and is installed in folder
JRE_path
, then to configure MATLAB, type:jenv("JRE_path")
Restart MATLAB.
Verify:
jenv
Alternatively, call matlab_jenv
from the operating system prompt to change the MATLAB configuration.