Skip to content

Instantly share code, notes, and snippets.

@xranby
Last active December 24, 2015 09:18
Show Gist options
  • Save xranby/9c87ab55fa38fd1f652c to your computer and use it in GitHub Desktop.
Save xranby/9c87ab55fa38fd1f652c to your computer and use it in GitHub Desktop.
one-jar test
steps to reproduce
1. download onejar-app-gen-0.97.jar from http://sourceforge.net/projects/one-jar/files/latest/download?source=dlp
2. setup the /home/user/2.0.2/movieplayer using
java -jar onejar-app-gen-0.97.jar
3. copy all jogamp jars + junit4 to /home/user/2.0.2/movieplayer/lib/
(remove gluegen.jar and gluegen-rt-android.jar)
4. change build.xml to use the one-jar main class
<attribute name="Main-Class" value="com.simontuffs.onejar.Boot"/>
<attribute name="One-Jar-Main-Class" value="com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube"/>
5. build using ant
6. cd build
7. run
xranby@xranby-ESPRIMO-P7935:~/2.0.2/movieplayer/build$ java -jar movieplayer.jar
TexCubeES2.run()
forceES2 false
forceES3 false
forceGL3 false
forceGLDef false
Catched FileNotFoundException: /movieplayer.jar (Filen eller katalogen finns inte), while TempJarCache.bootstrapNativeLib() of jar:file:/movieplayer.jar!/lib/gluegen-rt-natives-linux-i586.jar!/ (file:/movieplayer.jar!/lib/ + gluegen-rt-natives-linux-i586.jar)
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.simontuffs.onejar.Boot.run(Boot.java:342)
at com.simontuffs.onejar.Boot.main(Boot.java:168)
Caused by: 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:213)
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 com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube.main(MovieCube.java:252)
... 6 more
xranby@xranby-ESPRIMO-P7935:~/2.0.2/movieplayer/build$ unzip -l movieplayer.jar
Archive: movieplayer.jar
Length Date Time Name
--------- ---------- ----- ----
1175 2013-10-01 11:36 main/main.jar
23 2011-05-04 14:34 .version
1046 2011-05-04 12:05 OneJar.class
1700 2011-05-04 12:58 com/simontuffs/onejar/Boot$1.class
1905 2011-05-04 12:58 com/simontuffs/onejar/Boot$2.class
1398 2011-05-04 12:58 com/simontuffs/onejar/Boot$3.class
17398 2011-05-04 12:58 com/simontuffs/onejar/Boot.class
1771 2011-05-04 12:05 com/simontuffs/onejar/Handler$1.class
863 2011-05-04 12:05 com/simontuffs/onejar/Handler.class
280 2011-05-04 12:40 com/simontuffs/onejar/IProperties.class
2532 2011-05-04 12:40 com/simontuffs/onejar/JarClassLoader$1.class
848 2011-05-04 12:40 com/simontuffs/onejar/JarClassLoader$2.class
974 2011-05-04 12:40 com/simontuffs/onejar/JarClassLoader$ByteCode.class
1072 2011-05-04 12:40 com/simontuffs/onejar/JarClassLoader$FileURLFactory$1.class
2320 2011-05-04 12:40 com/simontuffs/onejar/JarClassLoader$FileURLFactory.class
430 2011-05-04 12:40 com/simontuffs/onejar/JarClassLoader$IURLFactory.class
1414 2011-05-04 12:40 com/simontuffs/onejar/JarClassLoader$OneJarURLFactory.class
29043 2011-05-04 12:40 com/simontuffs/onejar/JarClassLoader.class
543 2011-05-04 12:05 com/simontuffs/onejar/OneJarFile$1.class
1298 2011-05-04 12:05 com/simontuffs/onejar/OneJarFile$2.class
3529 2011-05-04 12:05 com/simontuffs/onejar/OneJarFile.class
1638 2011-05-04 12:05 com/simontuffs/onejar/OneJarURLConnection.class
1781 2010-07-15 16:33 doc/one-jar-license.txt
0 2013-10-01 11:36 META-INF/
215 2013-10-01 11:36 META-INF/MANIFEST.MF
0 2013-10-01 11:36 lib/
6718 2013-10-01 11:15 lib/gluegen-rt-natives-android-armv6.jar
3680 2013-10-01 11:15 lib/gluegen-rt-natives-linux-amd64.jar
2485 2013-10-01 11:15 lib/gluegen-rt-natives-linux-armv6.jar
2485 2013-10-01 11:15 lib/gluegen-rt-natives-linux-armv6hf.jar
3627 2013-10-01 11:15 lib/gluegen-rt-natives-linux-i586.jar
4008 2013-10-01 11:15 lib/gluegen-rt-natives-macosx-universal.jar
4029 2013-10-01 11:15 lib/gluegen-rt-natives-solaris-amd64.jar
3368 2013-10-01 11:15 lib/gluegen-rt-natives-solaris-i586.jar
6340 2013-10-01 11:15 lib/gluegen-rt-natives-windows-amd64.jar
4486 2013-10-01 11:15 lib/gluegen-rt-natives-windows-i586.jar
257122 2013-10-01 11:15 lib/gluegen-rt.jar
64168 2013-10-01 11:15 lib/joal-android.jar
164335 2013-10-01 11:15 lib/joal-natives-android-armv6.jar
185718 2013-10-01 11:15 lib/joal-natives-linux-amd64.jar
172270 2013-10-01 11:15 lib/joal-natives-linux-armv6.jar
172434 2013-10-01 11:15 lib/joal-natives-linux-armv6hf.jar
183011 2013-10-01 11:15 lib/joal-natives-linux-i586.jar
15586 2013-10-01 11:15 lib/joal-natives-macosx-universal.jar
10169 2013-10-01 11:15 lib/joal-natives-solaris-amd64.jar
7127 2013-10-01 11:15 lib/joal-natives-solaris-i586.jar
185527 2013-10-01 11:15 lib/joal-natives-windows-amd64.jar
176907 2013-10-01 11:15 lib/joal-natives-windows-i586.jar
2748708 2013-10-01 11:15 lib/joal-test-android.jar
2738398 2013-10-01 11:15 lib/joal-test.jar
64168 2013-10-01 11:15 lib/joal.jar
13098 2013-10-01 11:15 lib/jocl-natives-android-armv6.jar
11212 2013-10-01 11:15 lib/jocl-natives-linux-amd64.jar
8213 2013-10-01 11:15 lib/jocl-natives-linux-armv6.jar
8212 2013-10-01 11:15 lib/jocl-natives-linux-armv6hf.jar
11531 2013-10-01 11:15 lib/jocl-natives-linux-i586.jar
26235 2013-10-01 11:15 lib/jocl-natives-macosx-universal.jar
10549 2013-10-01 11:15 lib/jocl-natives-solaris-amd64.jar
8039 2013-10-01 11:15 lib/jocl-natives-solaris-i586.jar
13643 2013-10-01 11:15 lib/jocl-natives-windows-amd64.jar
10804 2013-10-01 11:15 lib/jocl-natives-windows-i586.jar
483875 2013-10-01 11:15 lib/jocl.jar
3105417 2013-10-01 11:15 lib/jogl-all-android.jar
3242643 2013-10-01 11:15 lib/jogl-all-mobile.jar
40197 2013-10-01 11:15 lib/jogl-all-natives-android-armv6.jar
173907 2013-10-01 11:15 lib/jogl-all-natives-linux-amd64.jar
113696 2013-10-01 11:15 lib/jogl-all-natives-linux-armv6.jar
115012 2013-10-01 11:15 lib/jogl-all-natives-linux-armv6hf.jar
172571 2013-10-01 11:15 lib/jogl-all-natives-linux-i586.jar
368859 2013-10-01 11:15 lib/jogl-all-natives-macosx-universal.jar
163449 2013-10-01 11:15 lib/jogl-all-natives-solaris-amd64.jar
115585 2013-10-01 11:15 lib/jogl-all-natives-solaris-i586.jar
127716 2013-10-01 11:15 lib/jogl-all-natives-windows-amd64.jar
147167 2013-10-01 11:15 lib/jogl-all-natives-windows-i586.jar
4080122 2013-10-01 11:15 lib/jogl-all-noawt.jar
4352398 2013-10-01 11:15 lib/jogl-all.jar
1819714 2013-10-01 11:15 lib/jogl-test-android.jar
1761806 2013-10-01 11:15 lib/jogl-test.jar
222584 2013-10-01 11:16 lib/junit4.jar
--------- -------
27990324 79 files
xranby@xranby-ESPRIMO-P7935:~/2.0.2/movieplayer/build$ unzip movieplayer.jar META-INF/MANIFEST.MF
inflating: META-INF/MANIFEST.MF
xranby@xranby-ESPRIMO-P7935:~/2.0.2/movieplayer/build$ cat META-INF/MANIFEST.MF
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.2
Created-By: One-Jar 0.97 Ant taskdef
Main-Class: com.simontuffs.onejar.Boot
One-Jar-Main-Class: com.jogamp.opengl.test.junit.jogl.demos.es2.av.Mov
ieCube
xranby@xranby-ESPRIMO-P7935:~/2.0.2/movieplayer/build$ java -Djogamp.debug=all -jar movieplayer.jar
TexCubeES2.run()
forceES2 false
forceES3 false
forceGL3 false
forceGLDef false
getJarURI Default jar:file:/movieplayer.jar!/lib/gluegen-rt.jar!/com/jogamp/common/os/Platform.class
-> jar:file:/movieplayer.jar!/lib/gluegen-rt.jar!/com/jogamp/common/os/Platform.class
IOUtil.getTempRoot(): temp dirs: exec: /tmp/jogamp_0000, noexec: /tmp/jogamp_0000
TempFileCache: Static Initialization ---------------------------------------------- OK: true
TempFileCache: Thread: main, CL 0xbe8e12, tempBaseDir /tmp/jogamp_0000/file_cache
TempFileCache: tmpFile = /tmp/jogamp_0000/file_cache/jln2969071767219936991.tmp
TempFileCache: lckFile = /tmp/jogamp_0000/file_cache/jln2969071767219936991.lck
TempFileCache: tmpRootDir = /tmp/jogamp_0000/file_cache/jln2969071767219936991
TempFileCache: Setting jnlp.jogamp.tmp.cache.root=jln2969071767219936991
------------------------------------------------------------------ OK: true
TempFileCache: new TempFileCache() --------------------- (static ok: true)
TempFileCache: Thread: main, CL 0xbe8e12, this 0x39d3d3
TempFileCache: tempDir /tmp/jogamp_0000/file_cache/jln2969071767219936991/jln8181185796164485544 (ok: true)
TempFileCache: *** Reaper: deleteOldTempDirs in /tmp/jogamp_0000/file_cache
----------------------------------------------------------
TempJarCache.initSingleton(): ok true, /tmp/jogamp_0000/file_cache/jln2969071767219936991/jln8181185796164485544
getJarName res: gluegen-rt.jar
getJarSubURI res: file:/movieplayer.jar!/lib/gluegen-rt.jar
getURIDirname file:/movieplayer.jar!/lib/gluegen-rt.jar, extForm: file:/movieplayer.jar!/lib/gluegen-rt.jar
getJarURIDirname res: file:/movieplayer.jar!/lib/
TempFileCache: removeAll(/tmp/jogamp_0000/file_cache/jln3376215014381473628)
TempFileCache: removeAll(/tmp/jogamp_0000/file_cache/jln3376215014381473628/jln7546205029849721138)
TempFileCache: removeAll(/tmp/jogamp_0000/file_cache/jln3376215014381473628/jln7546205029849721138.tmp)
TempJarCache: bootstrapNativeLib(certClass: class com.jogamp.common.os.Platform, libBaseName gluegen-rt, jarURI jar:file:/movieplayer.jar!/lib/gluegen-rt-natives-linux-i586.jar!/)
getJarFile: jar:file:/movieplayer.jar!/lib/gluegen-rt-natives-linux-i586.jar!/
getJarSubURI res: file:/movieplayer.jar!/lib/gluegen-rt-natives-linux-i586.jar
Catched FileNotFoundException: /movieplayer.jar (Filen eller katalogen finns inte), while TempJarCache.bootstrapNativeLib() of jar:file:/movieplayer.jar!/lib/gluegen-rt-natives-linux-i586.jar!/ (file:/movieplayer.jar!/lib/ + gluegen-rt-natives-linux-i586.jar)
NativeLibrary.findLibrary(<gluegen-rt>) (TempJarCache): null
NativeLibrary.findLibrary(<gluegen-rt>, com.simontuffs.onejar.JarClassLoader@be8e12) (CL): null
JNILibLoaderBase: loadLibraryInternal(gluegen-rt), TempJarCache: null
JNILibLoaderBase: System.loadLibrary(gluegen-rt) - mode 3
JNILibLoaderBase: loadLibraryInternal(gluegen-rt): OK - mode 3
JNILibLoaderBase: Loaded Native Library: gluegen-rt
JNILibLoaderBase: loaded gluegen-rt
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.simontuffs.onejar.Boot.run(Boot.java:342)
at com.simontuffs.onejar.Boot.main(Boot.java:168)
Caused by: 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:213)
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 com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube.main(MovieCube.java:252)
... 6 more
tested using 1a8d2c627dbab5234aea72a458c00b6bba28add0 844 fix
xranby@xranby-ESPRIMO-P7935:~/2.1.0/movieplayer/build$ java -Djogamp.debug=all -jar movieplayer.jar
TexCubeES2.run()
forceES2 false
forceES3 false
forceGL3 false
forceGLDef false
getJarURI Default jar:file:/movieplayer.jar!/lib/gluegen-rt-android.jar!/com/jogamp/common/os/Platform.class
-> jar:file:/movieplayer.jar!/lib/gluegen-rt-android.jar!/com/jogamp/common/os/Platform.class
IOUtil.getTempRoot(): temp dirs: exec: /tmp/jogamp_0000, noexec: /tmp/jogamp_0000
TempFileCache: Static Initialization ---------------------------------------------- OK: true
TempFileCache: Thread: main, CL 0xbe8e12, tempBaseDir /tmp/jogamp_0000/file_cache
TempFileCache: tmpFile = /tmp/jogamp_0000/file_cache/jln6460890523224148053.tmp
TempFileCache: lckFile = /tmp/jogamp_0000/file_cache/jln6460890523224148053.lck
TempFileCache: tmpRootDir = /tmp/jogamp_0000/file_cache/jln6460890523224148053
TempFileCache: Setting jnlp.jogamp.tmp.cache.root=jln6460890523224148053
------------------------------------------------------------------ OK: true
TempFileCache: new TempFileCache() --------------------- (static ok: true)
TempFileCache: Thread: main, CL 0xbe8e12, this 0x16ac22d
TempFileCache: *** Reaper: deleteOldTempDirs in /tmp/jogamp_0000/file_cache
TempFileCache: tempDir /tmp/jogamp_0000/file_cache/jln6460890523224148053/jln5043091641533793754 (ok: true)
----------------------------------------------------------
TempJarCache.initSingleton(): ok true, /tmp/jogamp_0000/file_cache/jln6460890523224148053/jln5043091641533793754
TempFileCache: removeAll(/tmp/jogamp_0000/file_cache/jln3327520756095573567)
TempFileCache: removeAll(/tmp/jogamp_0000/file_cache/jln3327520756095573567/jln796634814345233121.tmp)
TempFileCache: removeAll(/tmp/jogamp_0000/file_cache/jln3327520756095573567/jln796634814345233121)
TempFileCache: removeAll(/tmp/jogamp_0000/file_cache/jln3327520756095573567/jln796634814345233121/libgluegen-rt.so)
TempFileCache: removeAll(/tmp/jogamp_0000/file_cache/jln3327520756095573567/jln796634814345233121/libnewt.so)
TempFileCache: removeAll(/tmp/jogamp_0000/file_cache/jln3327520756095573567/jln796634814345233121/libnativewindow_awt.so)
TempFileCache: removeAll(/tmp/jogamp_0000/file_cache/jln3327520756095573567/jln796634814345233121/libnativewindow_x11.so)
TempFileCache: removeAll(/tmp/jogamp_0000/file_cache/jln3327520756095573567/jln796634814345233121/libjogl_desktop.so)
TempFileCache: removeAll(/tmp/jogamp_0000/file_cache/jln3327520756095573567/jln796634814345233121/libjogl_mobile.so)
JNILibLoaderBase: addNativeJarLibs0(classesFromJavaJars [class com.jogamp.common.os.Platform], singleJarMarker null, stripBasenameSuffixes none
getJarURI Default jar:file:/movieplayer.jar!/lib/gluegen-rt-android.jar!/com/jogamp/common/os/Platform.class
-> jar:file:/movieplayer.jar!/lib/gluegen-rt-android.jar!/com/jogamp/common/os/Platform.class
getJarName res: gluegen-rt-android.jar
getJarSubURI res: file:/movieplayer.jar!/lib/gluegen-rt-android.jar
getJarURIDirname res: file:/movieplayer.jar!/lib/
addNativeJarLibsImpl(classFromJavaJar class com.jogamp.common.os.Platform, classJarURI jar:file:/movieplayer.jar!/lib/gluegen-rt-android.jar!/com/jogamp/common/os/Platform.class, nativeJarBaseName gluegen-rt-android): gluegen-rt-android-natives-linux-i586.jar + file:/movieplayer.jar!/lib/ -> jar:file:/movieplayer.jar!/lib/gluegen-rt-android-natives-linux-i586.jar!/
getJarFile: jar:file:/movieplayer.jar!/lib/gluegen-rt-android-natives-linux-i586.jar!/
getJarSubURI res: file:/movieplayer.jar!/lib/gluegen-rt-android-natives-linux-i586.jar
Catched FileNotFoundException: /movieplayer.jar (Filen eller katalogen finns inte), while addNativeJarLibsImpl(classFromJavaJar class com.jogamp.common.os.Platform, classJarURI jar:file:/movieplayer.jar!/lib/gluegen-rt-android.jar!/com/jogamp/common/os/Platform.class, nativeJarBaseName gluegen-rt-android): gluegen-rt-android-natives-linux-i586.jar + file:/movieplayer.jar!/lib/ -> jar:file:/movieplayer.jar!/lib/gluegen-rt-android-natives-linux-i586.jar!/
java.io.FileNotFoundException: /movieplayer.jar (Filen eller katalogen finns inte)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:215)
at java.util.zip.ZipFile.<init>(ZipFile.java:145)
at java.util.jar.JarFile.<init>(JarFile.java:153)
at java.util.jar.JarFile.<init>(JarFile.java:90)
at sun.net.www.protocol.jar.URLJarFile.<init>(URLJarFile.java:93)
at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:69)
at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:73)
at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:122)
at sun.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:89)
at com.jogamp.common.util.JarUtil.getJarFile(JarUtil.java:454)
at com.jogamp.common.util.cache.TempJarCache.addNativeLibs(TempJarCache.java:209)
at com.jogamp.common.jvm.JNILibLoaderBase.addNativeJarLibsImpl(JNILibLoaderBase.java:170)
at com.jogamp.common.jvm.JNILibLoaderBase.addNativeJarLibs(JNILibLoaderBase.java:336)
at com.jogamp.common.os.Platform$1.run(Platform.java:196)
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 com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube.main(MovieCube.java:252)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.simontuffs.onejar.Boot.run(Boot.java:342)
at com.simontuffs.onejar.Boot.main(Boot.java:168)
JNILibLoaderBase: addNativeJarLibs0(..) done, count 0, ok false
NativeLibrary.findLibrary(<gluegen-rt>) (TempJarCache): null
NativeLibrary.findLibrary(<gluegen-rt>, com.simontuffs.onejar.JarClassLoader@be8e12) (CL): null
JNILibLoaderBase: loadLibraryInternal(gluegen-rt), TempJarCache: null
JNILibLoaderBase: System.loadLibrary(gluegen-rt) - mode 3
JNILibLoaderBase: loadLibraryInternal(gluegen-rt): OK - mode 3
JNILibLoaderBase: Loaded Native Library: gluegen-rt
JNILibLoaderBase: loaded gluegen-rt
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.simontuffs.onejar.Boot.run(Boot.java:342)
at com.simontuffs.onejar.Boot.main(Boot.java:168)
Caused by: 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:205)
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 com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube.main(MovieCube.java:252)
... 6 more
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment