Re: Loading libraries from an executable JAR is seriously hard.
Posted by bkuker on Apr 05, 2012; 9:53am
URL: https://forum.jogamp.org/Loading-libraries-from-an-executable-JAR-is-seriously-hard-tp3885657p3886761.html
It sounds from some other posts like you are planing to drop the architecture specific jars in favor of one all-encompassing JAR. If that is the case I would assume you are going to have to use architecture specific directories anyway?
[arch]/[libname].[so,dll,whatever]
Currently it looks like the code goes:
1. Try to load library from natives jar in same location as gluegen jar.
2. Try to load library from library.path
could it be as simple as:
1. Try to load library from natives jar in same location as gluegen jar.
2. Try to load library from SomeJogAmpClass.class.getClassLoader().getResource([arch]/[library]).
3. Try to load library from library.path
I assume once you have an input stream for the library you can copy it to whatever temp place it goes to and loadLibrary(). Resources are commonly used, easy to understand, and in a pinch if someone needed to do something crazy in a standalone app they could do it with a custom classloader.