Can I use the SDK Compiler in 2015a with a version of Java that didn't come with MATLAB?

조회 수: 1 (최근 30일)
I would like to wrap my MATLAB code into a Java class using the MATLAB Compiler SDK. MATLAB version 2015a is shipped with an older version of Java - more specifically Java 1.7.0_60. I downloaded and installed Java 1.7.0_60 and then configured my Java environment and was able to successfully generate a .jar file. However, it turns out that Java 1.8.0_66 is the only version of Java approved to be on my computer.
I tried adding a MATLAB_JAVA environment variable as described here: http://www.mathworks.com/matlabcentral/answers/130359-how-do-i-change-the-java-virtual-machine-jvm-that-matlab-is-using-on-windows and pointed it to the following directory: C:\Program Files\Java\jre1.8.0_66. However, when I open MATLAB I see many errors caused by java.lang.RuntimeException: XPathFactory#newInstance().... Additionally, when I go to select Library Compiler from Apps, the content within the window never loads.
Is there a potential work-around here? Is it possible to set MATLAB_JAVA to point to a newer version of Java without compromising the use of the SDK Compiler?
  댓글 수: 1
ZBMedina
ZBMedina 2016년 3월 29일
I'm having the same problem with Matlab 2015b and JDK 1.8. Older version of JDK are no longer approved on any PC on the network. Please let me know if you have found a solution.

댓글을 달려면 로그인하십시오.

답변 (1개)

Harsheel
Harsheel 2015년 12월 7일
What you are doing is changing the JAVA version for MATLAB and all the toolboxes. You don't need to do that, revert this change.
For Compiler SDK, create an environment variable JAVA_HOME and set it to the JDK path. What you have installed is JRE. Please install the JDK. For example, JAVA_HOME will look like:
C:\Program Files\Java\jdk1.7.0_60
This will ensure that Compiler SDK uses JDK 1.7 to convert the .m files into .jar files. Meanwhile, MATLAB and other products will continue to use JRE 7 that is shipped with MATLAB.
More info can be found here
  댓글 수: 2
LEW1102
LEW1102 2015년 12월 7일
Hi Harsheel, I would like to clarify my previous post. Prior to today, I had found the link you provided and followed all of the steps and had success. However, my system got black listed last week when a scan reported that I had installed JDK 1.7.0_60. As a result, I had to remove this version of Java from my machine. The only JDK allowed on my system is 1.8.0_66. Now, I am trying to repeat what I was able to do before, but with JDK 1.8.0_66 installed on my machine. If I set JAVA_HOME to the following: C:\Program Files\Java\jdk1.8.0_66 I get errors during packaging. If an error log would be helpful, let me know and I can attach one. Here is what I'm trying to figure out: Is it possible use the compiler to create a Java package with my new version of Java (1.8.0_66)?
Harsheel
Harsheel 2015년 12월 8일
Unfortunately, this is currently not supported. You need to exactly have JDK 1.7.0_60.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Java Package Integration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by