System.loadLibrary doesn't work, System.load works...
823227Dec 12 2010 — edited Dec 12 2010Hello,
I have in folder "/usr/local/lib" a library "abc.so".
I have the following program:
public class Test {
public static void main(String[] args) throws Exception {
System.out.println(System.getProperty("java.library.path"));
System.loadLibrary("abc");
}
}
If i compile and start with java -Djava.library.path=/usr/local/lib/ Test
i get following error:
/usr/local/lib
Exception in thread "main" java.lang.UnsatisfiedLinkError: no abc in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1681)
at java.lang.Runtime.loadLibrary0(Runtime.java:840)
at java.lang.System.loadLibrary(System.java:1047)
at TestEID.main(TestEID.java:9)
If i use System.load("/usr/local/lib/abc.so");
It works...
Why doesn't work loadLibrary? Thanks in advace.