2

I am trying to run my program from my jar, called PViz.jar. The jar is sitting in a directory with all of its dependent jars and the .so files that they depend on. I am using Mac OS X. When I run this:

java -cp PViz.jar pviz.PVizStart

Then I get an UnsatisfiedLinkError saying "no jogl in java.library.path". This is reasonable, i'm using jogl.jar which makes use of the native library libjogl.so.

So I run this:

java -Djava.library.path=. -cp PViz.jar pviz.PVizStart

and I get the same error. But libjogl.so is in the current directory! I figured maybe I needed to give the whole path, so I tried this:

java -Djava.library.path=/bla/bla/bla/libjogl.so -cp PViz.jar pviz.PVizStart

and it still gives me the same UnsatisifedLinkError. Argh!

evilfred
  • 2,314
  • 4
  • 29
  • 44

2 Answers2

2

Here is a step by step explanation on how to setup jogl on different operating systems, OS X included.

zellus
  • 9,617
  • 5
  • 39
  • 56
0

Try loading the lib in a static initializer in one of the main classes of your app.

Example (Copied + renamed from one of my projects):

public class MainClass {
    static {
        System.loadLibrary( "Your_native_lib_file_name" ); // Note: do not include the file extension!
    }
}

The native lib should be in the same directory as your jar.

Andy
  • 5,108
  • 3
  • 26
  • 37