Skip to Main Content

Java HotSpot Virtual Machine

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!

setting java.library.path property in java code

843829May 17 2005 — edited Oct 28 2008
Hi,
i'd like to set java.library.path property in java code to load a dll-library. I know that a funtional way is to run JVM with parameter -Djava.library.path=c:\tmp, but I need it do it IN CODE.

I'v tried this:
System.setProperty("java.library.path", "c:\\tmp");
System.loadLibrary("libapr");
The library 'libapr.dll' is situated really in 'c:\tmp' directory, but I get 'java.lang.UnsatisfiedLinkError: no libapr in java.library.path' exception.

It seems like the already running java program doesn't use actual java.library.path set in previous step.

Is there any possibility to set java.library.path property in java code?

Thanx

Brny
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 25 2008
Added on May 17 2005
22 comments
3,827 views