Reputation: 2416
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!
Upvotes: 2
Views: 4724
Reputation: 9582
Here is a step by step explanation on how to setup jogl on different operating systems, OS X included.
Upvotes: 2
Reputation: 5228
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.
Upvotes: 0