Matlab does not find Java Runtime Environment (Mac Silicon)

282 visualizaciones (últimos 30 días)
Efren
Efren el 24 de Abr. de 2024
Comentada: Vincent el 11 de Oct. de 2024
Hello, I'm trying to install matlab in my computer (Macbook pro, M2). It requires a java runtime environment (JRE). It give as an option the one from Amazon, but I have a JRE installed directly from Java's website. After reading this article on how to change the JRE path from the command window, I run the following, from the hardrive location:
<path/to/matlab_jenv> <path/to/JRE>
I'm copy-pasting the JRE path from the java applet. Anyway, the error I'm getting is this:
"Unable to validate Java path: <path/to/JRE>".
Can anyone help? Thank you!!
  8 comentarios
Chris
Chris el 19 de Ag. de 2024
Editada: Chris el 19 de Ag. de 2024
@Aditya, according to this page, Java/Corretto is currently only supported up to version 17.
XING
XING el 3 de Sept. de 2024
1,直接从java官网下载安装的jre,是没有办法支持matlab运行的。比如,最开始是找不到java的运行环境,按照贴主的提示操作后,不再提示运行环境错误,而变成了打开软件闪退(错误报告: MATLAB 在处理 Java 虚拟机(JVM)相关的任务时发生了错误。)
2,安装好Amazon Corretto 11后(https://ww2.mathworks.cn/support/requirements/apple-silicon.html),在终端执行:/Applications/MATLAB_R2024a.app/bin/maca64/matlab_jenv /Library/Java/JavaVirtualMachines/amazon-corretto-11.jdk/Contents/Home。
能够正常运行了

Iniciar sesión para comentar.

Respuestas (2)

Marius
Marius el 28 de Sept. de 2024
Editada: Marius el 28 de Sept. de 2024
Hi,
I was having the same issue. I am using a Mac M3Pro which is also on the Apple Silicone.
First, get the location of your JAVA 11 runtime. I have multiple JDKs installed and managed the installation with SDKMAN.
Little installation guide for SDKMAN:
curl -s "https://get.sdkman.io" | bash
source "/Users/username/.sdkman/bin/sdkman-init.sh"
NB: SDKMAN additions are made to your .zshrc after installation. For SDKMAN to work THESE ADDITIONS NEED TO BE KEPT AT THE BOTTOM OF YOUR .ZSHRC!!
Once you found your desired java versions by running:
sdk list java
Run this to install your desired jdk:
sdk install java 11.0.23-amzn
You'll need to export it to your ~/.zshrc. Open up your ~/.zshrc with sudo nano ~/.zshrc and add this:
export MATLAB_JAVA=/Users/username/.sdkman/candidates/java/11.0.23-amzn
Update ~/.zshrc by running:
source ~/.zshrc
You can now run this command in your terminal to launch MATLAB by pointing it to your desired JDK (edit 20xx to match your MATLAB version. Mine was 2024b):
MATLAB_JAVA=$MATLAB_JAVA /Applications/MATLAB_R20xx.app/bin/matlab
  4 comentarios
Matei
Matei el 7 de Oct. de 2024
I just found a way to make MATLAB open every single time from the app icon, without any type of script.
First you need to get access to MATLAB's Command Window, and from there, you can change the path to the JRE permanently using the following command:
>> jenv('/Users/username/.sdkman/candidates/java/11.0.23-amzn')
From now on, everytime you open the app, it will use the JRE found on the path you specified in the command above.

Iniciar sesión para comentar.


Travis Massey
Travis Massey el 25 de Abr. de 2024
Editada: Walter Roberson el 25 de Abr. de 2024
I ran into this same issue in Windows today. The problem was that I had downloaded 32-bit Java (the default) instead of 64-bit.
I recognized that Java for Mac/ARM should only be 64-bit, but perhaps your default download also grabbed the wrong version, and there's another more appropriate version.
  3 comentarios
Mulazim Ali KHOKHAR
Mulazim Ali KHOKHAR el 15 de Mayo de 2024
I have the same problem. I tried the solution from Efren but it still just pops-in and pops-out and vanish. It's not stable to run the program. Any other solutions?
Efren
Efren el 15 de Mayo de 2024
Editada: Efren el 15 de Mayo de 2024
Did you check my comment above, in the original question? I give a step by step of te solution I found. (see my comment in response to Plante jean-luc's comment).

Iniciar sesión para comentar.

Categorías

Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by