Java - java.library.path problem on Linux

JohnIdol picture JohnIdol · Jun 21, 2011 · Viewed 9k times · Source

I am able to run a java program with some dependencies from cmd line on my mac, but when I try to run it on a linux SUSE 11 box I have it comes back with:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no myNativeLib in java.library.path

This is the cmd line I am running:

java -Djava.library.path=../lib -cp ../jar/a-jar.jar:. MyMainClass

Any help appreciated!

Answer

Alex Gitelman picture Alex Gitelman · Jun 21, 2011

I would recommend to use absolute path for java.library.path. At least you eliminate possible problems with relative path resolution.

Also, just to confirm, you do have Linux library in the lib, right? Mac one will not work.