Login  Register

Loading libraries from an executable JAR is seriously hard.

Posted by bkuker on Apr 04, 2012; 9:46pm
URL: https://forum.jogamp.org/Loading-libraries-from-an-executable-JAR-is-seriously-hard-tp3885657.html

I am trying to use JOGL (2.0 rc5) in a standalone Java app run from an executable JAR.

The app's jar is packaged by re-zipping all of the libraries into one fat jar. It's not my app, I can't change that.

The JogAmp projects do seem to know how to pull a native library out of a JAR (I assume they write it to a temp directory), but the way they find that resource seems really complex... It looks for the JAR that GlueGen came in, then looks for a jar in the same directory, using a naming convention including the architecture, and then gets native libraries from that jar.

This makes it really tough to package it into a single far jar. The eclipse jars-in-a-jar method works, but the "fat jar" method does not.

Is there any way I can just put the natives in my Jar, and give them to GlueGen & JOGL as streams (getResourceFromStream) or some such?