Using jogl in runnable jar, manual loading of dll
I'm using the jogl library to make nice 3D plots in my program. To use it in a runnable jar, I use the well-known trick to copy the dll out of it and putting it in a temporary location (for details see this question, also for the loadLib function mentioned below )
The problem is that I keep getting Unsatisfied link errors:
static {
mylogger().info("Loading jogl DLL");
// we need to put both DLLs to temp dir
String path = "MYAPP_" + new Date().getTime();
try {
loadLib(path, "gluegen-rt");
loadLib(path, "jogl");
loadLib(path, "jogl_cg");
loadLib(path, "jogl_awt");
li开发者_高级运维braryLoaded = true;
} catch(UnsatisfiedLinkError e) {
mylogger().error("Cannot load JOGL libraries: "+e.getMessage());
}
}
So, is there something wrong with the order of the libraries included? How can I find out what's the cause of the unsatisfied link error?
If you use the JogAmp "Fat-Jar" layout then JOGL and Gluegen will find and load the native library from inside your runnable jar.
use the following layout inside your jar:
/natives/<os.and.arch>/libLala1.so
/natives/<os.and.arch>/libLala2.so
https://jogamp.org/wiki/index.php/JogAmp_JAR_File_Handling#Custom_Bundling
精彩评论