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!

8
  • Have you tried to set the LD_LIBRARY_PATH? Commented Aug 27, 2010 at 19:20
  • Can you set the value of the environment variable "DYLD_LIBRARY_PATH" to your .so location and try it? Commented Aug 27, 2010 at 19:22
  • i would like to set this when I run it. i'm trying to make it easy to run on a friend's system without messing with his environment variables. Commented Aug 27, 2010 at 19:34
  • I'm not sure, but it could also be a permissions problem. Maybe libjogl.so needs to be executable? (Try chmod u+x libjogl.so). Commented Aug 27, 2010 at 19:38
  • 1
    Argh. Peter you're right. I didn't realize that the ".jnilib" files were required too. Java could really do with some more intuitive error messages!!!! Commented Aug 27, 2010 at 22:41

2 Answers 2

2

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

Sign up to request clarification or add additional context in comments.

1 Comment

eclipse does a fair amount of voodoo.
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.

7 Comments

I get the exact same error. I tried it doing this with -Djava.library.path-. and -Djava.library.path=/exact/path/to/dir/ and I still get the stupid UnsatisfiedLinkError.
I used System.loadLibrary("jogl"); where libjogl.so is in the same directory as the jar.
Are the native libs sitting next to their respective jar files in your directories?
Use System.loadLibrary("libjogl");
Yes they are Andy. I'll try that I guess.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.