Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

System.loadLibrary doesn't work, System.load works...

823227Dec 12 2010 — edited Dec 12 2010
Hello,

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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 9 2011
Added on Dec 12 2010
1 comment
265 views