Matlab 2011 integration with java
2 views (last 30 days)
Show older comments
Guys:
I've been facing a problem with integrating an opensource RTI from Portico which was developed in c++ (MS Visual C++ 2010) and a java library portico.jar developed in java 1.7
The problem is I declare portico.jar in the classpath.txt file and run my program developed in c++ I get the following error messages:
java.lang.UnsupportedClassVersionError: org/jgroups/blocks/RequestHandler : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(Unknown Source) 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$000(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 org.portico.bindings.jgroups.JGroupsConnection.getFederationChannel(JGroupsConnection.java:215) at org.portico.bindings.jgroups.JGroupsConnection.createFederation(JGroupsConnection.java:229) at org.portico.lrc.services.federation.handlers.outgoing.CreateFederationHandler.process(CreateFederationHandler.java:79) at org.portico.utils.messaging.MessageSink.process(MessageSink.java:187) at org.portico.impl.hla1516e.Impl1516eHelper.processMessage(Impl1516eHelper.java:99) at org.portico.impl.hla1516e.Rti1516eAmbassador.processMessage(Rti1516eAmbassador.java:5473) at org.portico.impl.hla1516e.Rti1516eAmbassador.createFederation
Seems that it has to do with the java version used by matlab which is 1.6 (for all versions including the recent 2013).
I need to know if there is a workaround to allow jar files in version 1.7 run with matlab.
Sincerely, Andre Nudel
0 Comments
Accepted Answer
Friedrich
on 22 May 2013
Edited: Friedrich
on 22 May 2013
Hi,
MATLAB uses JAVA 6 so JAVA 7 compiled files wont work. However you can change the JAVA version MATLAB uses by creating an environment variable called MATLAB_JAVA whcih points to the JRE7 installation folder.
This can work but can also lead to undesirable behavior of MATLAB especially selfmade MATLAB GUIs can behave strange.
0 Comments
More Answers (1)
andre albagli
on 22 May 2013
2 Comments
Friedrich
on 22 May 2013
As long MATLAB uses JAVA 6 it's not tested/supported with JAVA 7. It sometimes works fine with JAVA7 and sometimes it crashes. But I am pretty confident that one of the next releases MATLAB will run on JAVA 7.
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!