We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I have a processing application that compiles and runs fine inside of Eclipse, but I need to export it to an executable. When I do this via Eclipse's export wizard, it produces a jar, but that jar produces runtime errors when it's double clicked or called from the command line. First it was giving me this:
C:\Users\Rachel\School\MQP>java -jar Simworm14.jar
Catched MalformedURLException: Could not open InputStream for URL 'rsrc:gluegen-
rt-natives-windows-amd64.jar', while addNativeJarLibsImpl(classFromJavaJar class
com.jogamp.common.os.Platform, classJarURI jar:rsrc:gluegen-rt.jar!/com/jogamp/
common/os/Platform.class, nativeJarBaseName gluegen-rt-natives-windows-amd64.jar
): [ rsrc:gluegen-rt.jar -> rsrc: ] + gluegen-rt-natives-windows-amd64.jar -> sl
im: jar:rsrc:gluegen-rt-natives-windows-amd64.jar!/
Exception in thread "Animation Thread" java.lang.UnsatisfiedLinkError: Can't loa
d library: C:\Users\Rachel\School\MQP\gluegen-rt.dll
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1706)
at java.lang.Runtime.load0(Runtime.java:770)
at java.lang.System.load(System.java:1003)
at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoad
erBase.java:551)
at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.ja
va:64)
at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNIL
ibLoaderBase.java:96)
at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.j
ava:414)
at com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibrar
y(DynamicLibraryBundle.java:388)
at com.jogamp.common.os.Platform$1.run(Platform.java:203)
at java.security.AccessController.doPrivileged(Native Method)
at com.jogamp.common.os.Platform.<clinit>(Platform.java:173)
at javax.media.opengl.GLProfile.<clinit>(GLProfile.java:82)
at processing.opengl.PJOGL.initSurface(PJOGL.java:250)
at processing.opengl.PGraphicsOpenGL.initPrimary(PGraphicsOpenGL.java:62
44)
at processing.opengl.PGraphicsOpenGL.requestDraw(PGraphicsOpenGL.java:16
25)
at processing.core.PApplet.run(PApplet.java:2177)
at java.lang.Thread.run(Thread.java:662)
So I tried pasting gluegen-rt.dll into the given directory, and then it gave me this error instead:
C:\Users\Rachel\School\MQP>java -jar Simworm14.jar
Catched MalformedURLException: Could not open InputStream for URL 'rsrc:gluegen-
rt-natives-windows-amd64.jar', while addNativeJarLibsImpl(classFromJavaJar class
com.jogamp.common.os.Platform, classJarURI jar:rsrc:gluegen-rt.jar!/com/jogamp/
common/os/Platform.class, nativeJarBaseName gluegen-rt-natives-windows-amd64.jar
): [ rsrc:gluegen-rt.jar -> rsrc: ] + gluegen-rt-natives-windows-amd64.jar -> sl
im: jar:rsrc:gluegen-rt-natives-windows-amd64.jar!/
Exception in thread "Animation Thread" java.lang.UnsatisfiedLinkError: C:\Users\
Rachel\School\MQP\gluegen-rt.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1807)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1703)
at java.lang.Runtime.load0(Runtime.java:770)
at java.lang.System.load(System.java:1003)
at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoad
erBase.java:551)
at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.ja
va:64)
at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNIL
ibLoaderBase.java:96)
at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.j
ava:414)
at com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibrar
y(DynamicLibraryBundle.java:388)
at com.jogamp.common.os.Platform$1.run(Platform.java:203)
at java.security.AccessController.doPrivileged(Native Method)
at com.jogamp.common.os.Platform.<clinit>(Platform.java:173)
at javax.media.opengl.GLProfile.<clinit>(GLProfile.java:82)
at processing.opengl.PJOGL.initSurface(PJOGL.java:250)
at processing.opengl.PGraphicsOpenGL.initPrimary(PGraphicsOpenGL.java:62
44)
at processing.opengl.PGraphicsOpenGL.requestDraw(PGraphicsOpenGL.java:16
25)
at processing.core.PApplet.run(PApplet.java:2177)
at java.lang.Thread.run(Thread.java:662)
After some googling, it appears this dependency issue might be a bug with jogl: https://java.net/jira/browse/JOGL-346 but I find it hard to believe that nobody has been able to export any processing applications from Eclipse. There's got to be a way, hasn't there?
Any suggestions?
Answers
This is because Processing requires native libraries that have to be specified before runtime.
You can use a tool I created called SvgExe to create a self-extracting runnable jar that handles that part for you: http://StaticVoidGames.com/SvgExe/