1

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");
            libraryLoaded = 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?

Community
  • 1
  • 1
Roalt
  • 8,330
  • 7
  • 41
  • 53
  • Do you know which library is missing? Did you check for the correct path? – Thomas May 11 '11 at 14:56
  • @Thomas: No, it doesn't give me any information what library is missing. – Roalt May 13 '11 at 14:21
  • What's the message of the `UnsatisfiedLinkError`? Did you put an individual try-catch block around each `loadLib()` call in order to see where exactly it is thrown (or debug somehow)? – Thomas May 13 '11 at 14:32

1 Answers1

1

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

xranby
  • 596
  • 4
  • 7