Skip to content

Latest commit

 

History

History
93 lines (68 loc) · 2.6 KB

Readme_java.md

File metadata and controls

93 lines (68 loc) · 2.6 KB

Matlab-Stdlib Java functions

Some Matlab-Stdlib functions use the factory JRE, and have been tested with JVM versions 8 and 17 and newer.

In general, Java's java.io.File() and java.nio.file don't work with Windows App Execution Aliases. However, Matlab's intrinsic file functions do work with Windows App Execution Aliases.

Matlab's Java interface was introduced in Matlab 6.0 R12 in the year 2000. GNU Octave also can use Java. Matlab-Stdlib uses only factory JRE classes where intrinsic Matlab code isn't easily capable of provided the needed algorithms.

Tell JVM version:

version("-java")

Get the Java API level:

stdlib.java_api()

Get the Java vendor:

stdlib.java_vendor()

Get the Java version:

stdlib.java_version()

From before Matlab R2019b to at least Matlab R2024b, the Matlab factory Java version is 1.8, which is adequate for all Matlab-stdlib functionality.

If desired (not used by Matlab-stdlib), one can use non-factory Java classes in Matlab and GNU Octave.

Configure Matlab JVM

The Matlab Java interface is like other Matlab external languages such as Python. The Matlab default JVM can be configured to compatible JRE across Matlab versions by using the jenv Matlab function.

Tell JVM details:

jenv

For example, to use the JDK 17 on macOS download and extract the ARM64 Compressed Archive. Tell Matlab to use this JDK from the Matlab console by:

jenv("/path/to/jdk-17/Contents/Home")

To revert back to the factory JRE if Matlab can't start or has problems, from system Terminal (not within Matlab):

matlab_jenv factory

Configure GNU Octave JVM

GNU Octave JVM can be configured with the JAVA_HOME environment variable. Some install packages don't include Java. For example, with Homebrew:

brew install octave openjdk