JDK provider and version disparities
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am using Matlab Compiler SDK to make `intlinprog` invokable from Java. I don't program in Java (yet), but have used C++/STL 15 years ago, and used OOP in VBA and Matlab. Java coding logic will probably not be a showstopper for a newbie like me; design patterns, may be more of a challenge, but my stumbling block right now is Java/JDK versions. I've read all I can about them, and now have to discover the reality by doing.
Disparity in JDK provider
I ran into my first version puzzlement in Matlab documentation on configuring the java environment:
[1] https://www.mathworks.com/help/compiler_sdk/ml_code/configure-your-java-environment.html
It says to find Java version in my MATLAB installation using `version -java`. In my MATLAB, the provider is Oracle:
Java 1.8.0_181-b13 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
However, the documentation [1] says to get the JDK from AdoptOpenJDK. I'm wondering whether this is a mistake? I have in fact installed AdoptOpenJDK's jdk-11.0.8.10-openj9, but I haven't found an Oracle JDK at their website.
Disparity in Java versions
Since Matlab has its own requirements for JDK version, is there a problem if the system that will invoke the Java-wrapped `intlinprog` uses a different JDK? I've read that Java is largely backward compatible, but I don't know what that means in this context.
Thanks for any clarification on the above disparities, and any reconciliation needed. Meanwhile, I will forge ahead with the documentation without changing my JDK unless I run into problems.
0 Kommentare
Akzeptierte Antwort
Todd Flanagan
am 29 Okt. 2020
Bearbeitet: Todd Flanagan
am 29 Okt. 2020
You are correct that MATLAB ships with an Oracle version of the JRE. Compiler SDK for Java requires a JDK to compile Java code. MATLAB currently supoprts Java 8, so you are free to use whichever 1.8 compliant JDK you prefer.
5 Kommentare
Heng gao
am 5 Mai 2021
This sounds different to mine.
I jsut installed Matlab2021a.
When i run version-java, it is a oracle java1.8,
but when i run compiler SDK, it is using java11.
This cause the produced by compiler SDK java code is uncompatible to run.
Also, my shell is using java1.8 as well
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Java Package Integration finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!