How do I change the Java Virtual Machine (JVM) that MATLAB is using on macOS?

347 visualizaciones (últimos 30 días)
How do I change the Java Virtual Machine (JVM) that MATLAB is using on macOS?

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 29 de Mzo. de 2024 a las 0:00
Editada: MathWorks Support Team el 29 de Mzo. de 2024 a las 18:15
Preface
Intel Versions of MATLAB
In MATLAB R2013a and earlier, MATLAB uses the system-wide JVM. In releases R2013b through R2019b, MATLAB uses the JVM that is bundled with MATLAB. Since R2020a, MATLAB also supports OpenJDK Java 8. Since R2023a, MATLAB supports OpenJDK Java 8 and 11.
Apple Silicon Versions of MATLAB
Since R2023b, native Apple silicon MATLAB requires a Java runtime be installed on your Mac. Amazon makes a suitable Java 8 JRE available free of charge as part of Amazon Corretto 8. For more information, see MATLAB on Apple Silicon Macs.
MATLAB is only fully supported for these specified versions of the JVM software. Some components might not work properly under a different version of the JVM software. For example, calling functions in a dynamically linked library that was created with a different JVM software version than that used by MATLAB might cause a segmentation violation error message.

 

How to change the JVM used by MATLAB

R2021b and newer

Please follow the instructions from our jenv documentation page in the link below.
jenv
Note: MATLAB_JAVA takes higher precedence over jenv/matlab_jenv when both are set.

 

R13 and newer

On the bash shell, execute:
export MATLAB_JAVA=<JRE path>
This setting will apply to MATLAB launched from that shell window.

 

On csh or tcsh shells, use the "setenv" command to set the MATLAB_JAVA environment variable. For example:
setenv MATLAB_JAVA <JRE path>
This command needs to be run in every new shell window.

 

Verifying the Installation

To verify that MATLAB is using the correct version of the JVM software, type the following at the MATLAB prompt:
>> version -java

 

If MATLAB is not using your value of MATLAB_JAVA, you may need to logout and log back in again.

 

Other Operating Systems/Platforms

To change the JVM MATLAB uses for other systems, use the following links.
  1 comentario
DGM
DGM el 15 de Mzo. de 2024
Posted as a comment-as-flag by James McDaniel :
I have not been able to follow these instructions. Why can't this be done by the MATLAB installer?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by