Azzera filtri
Azzera filtri

Importing JAVA class to Matlab - Error

4 visualizzazioni (ultimi 30 giorni)
Chintan Patel
Chintan Patel il 29 Set 2016
Risposto: David Barry il 3 Ott 2016
I am using Matlab 2016b. I compiled a java program, and modified the classpath.txt file in Matlab to include the .class and .jar file created after compiling the java program in Eclipse IDE. When I try to access the Java class in Matlab I get the following error:
Warning: A Java exception occurred trying to load the ITWOM_Release class: Java exception occurred: java.lang.UnsupportedClassVersionError: ITWOM_Release : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.mathworks.jmi.OpaqueJavaInterface.findClass(OpaqueJavaInterface.java:181)
Undefined function or variable 'ITWOM_Release'.

Risposte (1)

David Barry
David Barry il 3 Ott 2016
This is probably a Java version mismatch. It sounds like you might have compiled using a newer version of Java (possibly JDK 1.8) than MATLAB is using (1.7). You will need to adjust your compiler settings in Eclipse and re-compile.

Categorie

Scopri di più su Java Package Integration in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by