Main Content

JavaEnvironment

Java environment information

Since R2023a

Description

A JavaEnvironment object contains information about the Java® program on your system. Java environment information persists across different MATLAB® sessions.

Creation

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

Properties

expand all

This property is read-only.

Java version, returned as a string. To set the Version property, call jenv with the version argument set to a version number that MATLAB supports. For information about supported versions, see MATLAB Interfaces to Other Languages.

Example: "Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode​"

This property is read-only.

Home folder, returned 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, returned 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, returned as notloaded or loaded.

This property is read-only.

Settings value of Java, returned as a string with one of these values:

  • "factory" — Version included with MATLAB

  • "system" — Default version on your system

  • 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

See Also