Re: Packaging JOGL projects to be cross-platform?
Posted by KevinWorkman on Jan 24, 2014; 2:55am
URL: https://forum.jogamp.org/Packaging-JOGL-projects-to-be-cross-platform-tp4031261p4031315.html
Thank you, that's actually really helpful. I think I'm doing pretty much the same thing as you, just on Windows. I've created a Test.jar that contains my main class, a ProcessingClasspath.jar that contains all the Processing and JOGL classes, and then ProcessingNatives.jar that contains all of the natives. However, when I run the command, I get an UnsatisfiedLinkError. Here are the contents of each of my jars (I left out ProcessingClasspath.jar because it's huge). Strangely, if I create a fat jar out of all of these jars, it works.
Does anything obvious stick out below?
C:\Users\Kevin\Desktop\JWrapper\ProcessingNativeTest>
C:\Users\Kevin\Desktop\JWrapper\ProcessingNativeTest>jar -tf Test.jar
META-INF/MANIFEST.MF
Test.class
C:\Users\Kevin\Desktop\JWrapper\ProcessingNativeTest>jar -tf ProcessingNatives.j
ar
META-INF/
META-INF/MANIFEST.MF
natives/
natives/linux-amd64/
natives/linux-amd64/libgluegen-rt.so
natives/linux-amd64/libjogl_desktop.so
natives/linux-amd64/libjogl_mobile.so
natives/linux-amd64/libnativewindow_awt.so
natives/linux-amd64/libnativewindow_x11.so
natives/linux-amd64/libnewt.so
natives/linux-armv6hf/
natives/linux-armv6hf/libgluegen-rt.so
natives/linux-armv6hf/libjogl_desktop.so
natives/linux-armv6hf/libjogl_mobile.so
natives/linux-armv6hf/libnativewindow_awt.so
natives/linux-armv6hf/libnativewindow_x11.so
natives/linux-armv6hf/libnewt.so
natives/linux-i586/
natives/linux-i586/libgluegen-rt.so
natives/linux-i586/libjogl_desktop.so
natives/linux-i586/libjogl_mobile.so
natives/linux-i586/libnativewindow_awt.so
natives/linux-i586/libnativewindow_x11.so
natives/linux-i586/libnewt.so
natives/macosx-universal/
natives/macosx-universal/libgluegen-rt.jnilib
natives/macosx-universal/libjogl_desktop.jnilib
natives/macosx-universal/libjogl_mobile.jnilib
natives/macosx-universal/libnativewindow_awt.jnilib
natives/macosx-universal/libnativewindow_macosx.jnilib
natives/macosx-universal/libnewt.jnilib
natives/windows-amd64/
natives/windows-amd64/gluegen-rt.dll
natives/windows-amd64/jogl_desktop.dll
natives/windows-amd64/jogl_mobile.dll
natives/windows-amd64/nativewindow_awt.dll
natives/windows-amd64/nativewindow_win32.dll
natives/windows-amd64/newt.dll
natives/windows-i586/
natives/windows-i586/gluegen-rt.dll
natives/windows-i586/jogl_desktop.dll
natives/windows-i586/jogl_mobile.dll
natives/windows-i586/nativewindow_awt.dll
natives/windows-i586/nativewindow_win32.dll
natives/windows-i586/newt.dll
C:\Users\Kevin\Desktop\JWrapper\ProcessingNativeTest>java -cp Test.jar;Processin
gNatives.jar;ProcessingClasspath.jar Test
Catched FileNotFoundException: C:\Users\Kevin\Desktop\JWrapper\ProcessingNativeT
est\ProcessingClasspath-natives-windows-amd64.jar (The system cannot find the fi
le specified), while addNativeJarLibsImpl(classFromJavaJar class com.jogamp.comm
on.os.Platform, classJarURI jar:file:/C:/Users/Kevin/Desktop/JWrapper/Processing
NativeTest/ProcessingClasspath.jar!/com/jogamp/common/os/Platform.class, nativeJ
arBaseName ProcessingClasspath-natives-windows-amd64.jar): [ file:/C:/Users/Kevi
n/Desktop/JWrapper/ProcessingNativeTest/ProcessingClasspath.jar -> file:/C:/User
s/Kevin/Desktop/JWrapper/ProcessingNativeTest/ ] + ProcessingClasspath-natives-w
indows-amd64.jar -> slim: jar:file:/C:/Users/Kevin/Desktop/JWrapper/ProcessingNa
tiveTest/ProcessingClasspath-natives-windows-amd64.jar!/
Exception in thread "Animation Thread" java.lang.UnsatisfiedLinkError: Can't loa
d library: C:\Users\Kevin\Desktop\JWrapper\ProcessingNativeTest\gluegen-rt.dll
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1854)
at java.lang.Runtime.load0(Runtime.java:795)
at java.lang.System.load(System.java:1062)
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:238)
at processing.opengl.PGraphicsOpenGL.initPrimary(PGraphicsOpenGL.java:59
88)
at processing.opengl.PGraphicsOpenGL.requestDraw(PGraphicsOpenGL.java:16
00)
at processing.core.PApplet.run(PApplet.java:2177)
at java.lang.Thread.run(Thread.java:744)
C:\Users\Kevin\Desktop\JWrapper\ProcessingNativeTest>