Main Content

JavaEnvironment

R2026b

Java environment information

Since R2023a

Description

A JavaEnvironment object contains information about the Java® program that MATLAB® uses. Java environment information persists across different MATLAB sessions.

Creation

To create a JavaEnvironment object or change its properties, call jenv. You cannot change the Java environment after MATLAB loads the JRE™. To change the environment, call jenv and then restart MATLAB.

Properties

expand all

This property is read-only.

Java version, represented as a string. To set the Version property, call jenv with the version argument set to a version number that MATLAB supports. For version information, see Versions of OpenJDK Compatible with MATLAB by Release.

Example: "openjdk version "1.8.0_442""

This property is read-only.

Home folder, represented as a string that contains the path to the Java.Home system property.

Example: "/Applications/sys/java/jre"

This property is read-only.

Java Virtual Machine library file, represented as a string that contains the path to the file.

Example: "/Applications/sys/java/jre/lib/server/libjvm.dylib"​

This property is read-only.

Process status, represented as notloaded or loaded.

This property is read-only.

Settings value of Java, represented as a character vector that contains one of these values:

  • "system" — Default version on your system.

  • "factory" — Same as "system". (since R2026b)

  • Custom Java path — Folder of an installed Java on your computer.

To set the Configuration property, call jenv with the version argument.

Version History

Introduced in R2023a

expand all