MATLAB not detecting Java even after setting JAVA_HOME and MATLAB_JAVA

179 visualizzazioni (ultimi 30 giorni)
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 Commento
Ummama
Ummama il 7 Ago 2025
Modificato: Ummama il 7 Ago 2025
Hi, I have the same problem and I was wondering if you found a solution. If you have could you please share?

Accedi per commentare.

Risposte (2)

Martijn
Martijn il 19 Ago 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 il 27 Giu 2025
Matlab no longer uses Java starting with R2025a.
  2 Commenti
Leslie
Leslie il 30 Giu 2025
Hi Les,
Then which languages take replace of Java?
Thanks,
Leslie Zhai
Georgi
Georgi il 15 Ott 2025
Modificato: Georgi il 15 Ott 2025
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.

Accedi per commentare.

Categorie

Scopri di più su Startup and Shutdown in Help Center e File Exchange

Prodotti


Release

R2025a

Community Treasure Hunt

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

Start Hunting!

Translated by