MATLAB not detecting Java even after setting JAVA_HOME and MATLAB_JAVA

201 visualizaciones (últimos 30 días)
Harsh
Harsh el 27 de Jun. de 2025
Editada: Georgi el 15 de Oct. de 2025 a las 21:53
I'm trying to configure MATLAB to use a specific Java Development Kit (JDK) on my Windows 11 system. I have installed Eclipse Adoptium JDK 17 and correctly set the following environment variables:
JAVA_HOME = C:\Program Files\Eclipse Adoptium\jdk-17.0.15.6-hotspot
MATLAB_JAVA = C:\Program Files\Eclipse Adoptium\jdk-17.0.15.6-hotspot
However, when I start MATLAB and run the command `jenv`, I get the following output:
>> jenv
ans = JavaEnvironment with properties:
Version: "Java is not enabled"
Home: "Java is not enabled"
Library: "Java is not enabled"
Status: notloaded
Configuration: "C:\Program Files\Eclipse Adoptium\jdk-17.0.15.6-hotspot"
>>
I've also added `%JAVA_HOME%\bin` to the system PATH.ings I've already tried:
  • Verified the JDK version (it's 64-bit and not a JRE).
  • Ensured the folder path is correct and accessible.
  • Tried both user-level and system-level environment variables.
  • Tried launching MATLAB from the command prompt after setting JAVA_HOME manually.
I'm not sure what I'm missing here. How can I get MATLAB to detect and use this installed JDK?
Any help would be appreciated.
P.S. I am just a student so please pardon me if I've made any silly mistakes in the post or maybe even in what I am trying to do🙇
jenv
ans =
JavaEnvironment with properties: Version: "Java 1.8.0_292-b10 with AdoptOpenJDK OpenJDK 64-Bit Server VM mixed mode" Home: "/usr/lib/jvm/adoptopenjdk-8-hotspot-amd64/jre" Library: "/usr/lib/jvm/adoptopenjdk-8-hotspot-amd64/jre/lib/amd64/server/libjvm.so" Status: loaded Configuration: "factory"
  1 comentario
Ummama
Ummama el 7 de Ag. de 2025
Editada: Ummama el 7 de Ag. de 2025
Hi, I have the same problem and I was wondering if you found a solution. If you have could you please share?

Iniciar sesión para comentar.

Respuestas (2)

Martijn
Martijn el 19 de Ag. de 2025
Note that MATLAB R2025a can in fact still use Java for example if you want to call Java from MATLAB, see:
And it should still be possible to use MATLAB_JAVA to instruct MATLAB which Java to use once it actually needs it.
However, since MATLAB's own graphical user interface is no longer Java based in R2025a, it is not longer automatically loaded at startup. That is why jenv shows that the Status is notloaded right after startup and as long as it is not loaded the other values will indeed list Java is not enabled.
To see/verify whether MATLAB is indeed able to use the alternative Java as you tried configuring here, after startup make sure you do in fact run some code which really uses Java e.g. s = java.lang.String('Hello World') before you use jenv. After you have run this, jenv should report that Java has been loaded and it should populate the Version and other attributes.

Les Beckham
Les Beckham el 27 de Jun. de 2025
Matlab no longer uses Java starting with R2025a.
  2 comentarios
Leslie
Leslie el 30 de Jun. de 2025
Hi Les,
Then which languages take replace of Java?
Thanks,
Leslie Zhai
Georgi
Georgi el 15 de Oct. de 2025 a las 21:52
Editada: Georgi el 15 de Oct. de 2025 a las 21:53
Hi Leslie Zhai,
Java was used for the GUI (graphical user interface) in MatLab versions prior to R2025A.
Java is still there (factory included with the installer and residing in C:\Program Files\MATLAB\R2025A\...) but is not loaded on MatLab startup. As Martijn explained in an earlier Answer, you must start some function that requires java in order for MatLab to start it. For example, run java.lang.String('Hello World').
Then, execure jenv.
It will show the parameters of the (now) loaded Java environment.

Iniciar sesión para comentar.

Categorías

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

Productos


Versión

R2025a

Community Treasure Hunt

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

Start Hunting!

Translated by