Bug 563 - Catch exception if using .so instead of the *native*.jar
Summary: Catch exception if using .so instead of the *native*.jar
Status: RESOLVED FIXED
Alias: None
Product: Gluegen
Classification: JogAmp
Component: core (show other bugs)
Version: 2
Hardware: All all
: --- enhancement
Assignee: Sven Gothel
URL:
Depends on:
Blocks:
 
Reported: 2012-03-13 17:29 CET by Sylvestre Ledru
Modified: 2012-03-24 01:51 CET (History)
1 user (show)

See Also:
Type: ---
SCM Refs:
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sylvestre Ledru 2012-03-13 17:29:01 CET
I am planning to use directly these files:
libgluegen-rt.so, libjogl_desktop.so, libnativewindow_awt.so libnativewindow_x11.so
instead of jogl-all-natives-linux-amd64.jar & gluegen-rt-natives-linux-amd64.jar


When I started a code based on jogl, I get the following exception:

     [java] java.util.zip.ZipException: error in opening zip file
     [java] 	at java.util.zip.ZipFile.open(Native Method)
     [java] 	at java.util.zip.ZipFile.<init>(ZipFile.java:131)
     [java] 	at java.util.jar.JarFile.<init>(JarFile.java:150)
     [java] 	at java.util.jar.JarFile.<init>(JarFile.java:87)
     [java] 	at sun.net.www.protocol.jar.URLJarFile.<init>(URLJarFile.java:90)
     [java] 	at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:66)
     [java] 	at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:71)
     [java] 	at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:122)
     [java] 	at sun.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:89)
     [java] 	at com.jogamp.common.util.JarUtil.getJarFile(JarUtil.java:294)
     [java] 	at com.jogamp.common.util.cache.TempJarCache.bootstrapNativeLib(TempJarCache.java:346)
     [java] 	at com.jogamp.common.os.Platform$3.run(Platform.java:312)
     [java] 	at java.security.AccessController.doPrivileged(Native Method)
     [java] 	at com.jogamp.common.os.Platform.loadGlueGenRTImpl(Platform.java:303)
     [java] 	at com.jogamp.common.os.Platform.<clinit>(Platform.java:214)
     [java] 	at javax.media.opengl.GLProfile.<clinit>(GLProfile.java:79)
     [java] 	at org.scilab.forge.scirenderer.examples.utils.ExampleFrame.<init>(Unknown Source)
     [java] 	at org.scilab.forge.scirenderer.examples.LightenedCube.<init>(Unknown Source)
     [java] 	at org.scilab.forge.scirenderer.examples.LightenedCube.main(Unknown Source)


It would be nice if you could catch it.
Comment 1 Julien Gouesse 2012-03-15 22:46:22 CET
Hi


Set the flag jogamp.gluegen.UseTempJarCache to false in order to disable the automatic extraction of native libraries from JARs.
Comment 2 Julien Gouesse 2012-03-15 22:47:34 CET
There's no real bug, you just have to set the proper flag (jogamp.gluegen.UseTempJarCache) to false and it will work fine.
Comment 3 Sylvestre Ledru 2012-03-15 22:48:23 CET
OK. thanks!
Comment 4 Julien Gouesse 2012-03-16 10:27:41 CET
(In reply to comment #3)
> OK. thanks!

You're welcome. This kind of information should be in the user guide or in the documentation, I'm really sorry.
Comment 5 Sylvestre Ledru 2012-03-22 23:27:42 CET
Actually, I think something better could be done here.

Instead of getting an ugly stack trace with the message:
     [java] java.util.zip.ZipException: error in opening zip file

I think we could catch the exception and show a message like:
* could not zip the jar containing the native library. Check the path or declare jogamp.gluegen.UseTempJarCache to false.

don't you think ?
Comment 6 Julien Gouesse 2012-03-23 10:30:48 CET
Sven told me once that when this mechanism does not work, it uses a fallback on the previous behaviour. Please use the latest build to check that. If this fallback does not work, something should be done to fix that. Otherwise, this bug report should be closed once for all.
Comment 7 Sven Gothel 2012-03-24 01:51:18 CET
(In reply to comment #6)
> Sven told me once that when this mechanism does not work, it uses a fallback on
> the previous behaviour. Please use the latest build to check that. If this
> fallback does not work, something should be done to fix that. Otherwise, this
> bug report should be closed once for all.

Thats right, it should simply fall back to traditional native lib loading.

The only informal message currently dumped is:
  "Catched: error in opening zip file"

Yes, it could be enhanced, ie naming the actual file and mentioning the fallback action.

To reproduce this behavior, I simply removed the *natives* JARs 
and set the LD_LIBRARY_PATH properly.