Normally, when I invoke a java app from the command prompt I do something like this:
java -cp %PATH_TO_JAR_FILE%\myJAR.jar my.package.myclass
In my current configuration I have the jzy3d DLL dependencies on my windows path. I'm running windows 7 64-bit. Now, I have a Java graphical application that has an embedded jzy3d canvas within it. I can use the above command to start the application from the windows prompt, or I can start it from matlab using a call like this:
system('java -cp %PATH_TO_JAR_FILE% my.package.myclass')
Normally, to run any of the java apps directly from matlab the first thing I do is add the JAR file to the Matlab dynamic path. Then, all I have to do to run an application is something like this from the matlab prompt:
Now, in this case, I try to define the object calling its default empty constructor by typing:
The problem is that this only works for console and graphical apps that do NOT have an embedded jzy3d canvas or dependency. If I type the above assignment statement at the matlab prompt, after the JAR has been loaded into the dynamic classpath, I get this error:
Catched FileNotFoundException: C:\mypath\myJAR.jar (The system cannot find the file specified), while TempJarCache.bootstrapNativeLib() of
jar:file:/C:/mypath/myJAR-natives-windows-amd64.jar!/ (file:/C:/mypath/ + myJAR-natives-windows-amd64.jar)
Java exception occurred:
java.lang.UnsatisfiedLinkError: jogamp.common.jvm.JVMUtil.initialize(Ljava/nio/ByteBuffer;)Z
at jogamp.common.jvm.JVMUtil.initialize(Native Method)
at jogamp.common.jvm.JVMUtil.<clinit>(JVMUtil.java:58)
at com.jogamp.common.os.Platform$1.run(Platform.java:189)
at com.jogamp.common.os.Platform$1.run(Platform.java:183)
at java.security.AccessController.doPrivileged(Native Method)
at com.jogamp.common.os.Platform.<clinit>(Platform.java:183)
at javax.media.opengl.GLProfile.<clinit>(GLProfile.java:82)
at org.jzy3d.chart.Settings.<init>(Settings.java:19)
at org.jzy3d.chart.Settings.getInstance(Settings.java:48)
at my.package.myclass.initializePlotWindow(myclass.java:416)
at my.package.myclass.<init>(myclass.java:153)
Now, the file it's complaining about doesn't exist cause the JAR file I loaded is called myJAR.jar. So, just to see if it works, I create a duplicate copy and rename it to myJAR-natives-windows-amd64.jar, then restart matlab and reload myJAR.jar into the dynamic java path. Then I reattempt the assignment statement and get this error instead: (see below). Now it's not complaining about the file anymore, which is a good sign, but it complains about "No default device available". Is there some sort of configuration required to get a jzy3d based JAVA app to run from MATLAB? Some additional JARs I need to load? I figured since I purposefully built the JAR file so that ALL JAR dependencies are embedded within, and the DLL dependencies are all on the windows path, it should have access to everything it needs. That certainly works when running the app from the DOS prompt, eclipse, or through any other windows based APP. The problem is specific to MATLAB as far as I can tell. Just wondering if anyone has seen anything like this before.
Java exception occurred:
javax.media.opengl.GLException: No default device available
at javax.media.opengl.GLProfile.getProfileMap(GLProfile.java:1860)
at javax.media.opengl.GLProfile.isAvailable(GLProfile.java:223)
at javax.media.opengl.GLProfile.isAvailable(GLProfile.java:237)
at org.jzy3d.chart.Settings.<init>(Settings.java:19)
at org.jzy3d.chart.Settings.getInstance(Settings.java:48)
at my.package.myclass.initializePlotWindow(myclass.java:416)
at my.package.myclass.<init>(myclass.java:153)