Contenido principal

Configure MATLAB Parallel Server Workers to Use Java

R2026b

MATLAB® Parallel Server™ cluster workers require a Java® Runtime Environment (JRE™) to run MATLAB code that depends on Java libraries. This topic shows how to configure the MATLAB Parallel Server installation on each cluster node so that workers use a supported JRE by default.

Cluster users can select Java for their MATLAB worker session by using the jenv (MATLAB) function, but you can set the default JRE used by all workers by configuring the MATLAB Parallel Server installation.

Before you begin, ensure that a compatible OpenJDK® distribution is available for your MATLAB Parallel Server release and that you can run commands from an elevated (administrative) operating system prompt on each cluster node. For version information, see Versions of OpenJDK Compatible with MATLAB by Release. You must repeat the configuration on each cluster node that runs workers.

Configure Workers to Use Java

Use the following procedure to set the default JRE for future MATLAB Parallel Server worker sessions. You can use an existing compatible OpenJDK installation, or install a compatible OpenJDK version and then set the JRE path. Run these commands at an operating system prompt with administrative privileges.

  1. Check if you already have a compatible JRE on the node. At an operating system prompt, check the Java version on the system path.

    java -version

  2. If the first Java entry on the system path is compatible, continue to step 3.

    If Java is missing or the version is not supported, check whether a supported OpenJDK version is already installed elsewhere on the node, note its path and continue to step 3.

    If no supported version is available, download and install a supported version of OpenJDK from https://adoptium.net/. For version information, see Versions of OpenJDK Compatible with MATLAB by Release.

  3. Navigate to the folder that contains the matlab_jenv script for your MATLAB Parallel Server installation. Replace matlabroot with the name of the folder where you installed MATLAB Parallel Server.

    • Linux®: matlabroot/bin/glnxa64

    • Windows®: matlabroot\bin\win64

  4. Set the default JRE for the MATLAB Parallel Server installation using the matlab_jenv script.

    • If the first Java entry on your system path is compatible, then configure the MATLAB Parallel Server installation with this command.

      ./matlab_jenv -allusers system
    • If the first Java entry is not compatible, then you can specify a path to a compatible JRE installation instead. For example, if a compatible JRE is installed in the folder JRE_path, then configure the MATLAB Parallel Server installation with this command.

      ./matlab_jenv -allusers JRE_path

  5. Verify that the workers are configured to use the version of Java that you specified. The matlab_jenv script also displays information about the JRE version and the location of the installation.

    ./matlab_jenv

See Also

(MATLAB) | (MATLAB)

Topics

External Websites