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!

loadLibrary doesn't use java.library.path set at runtime

843829Jun 9 2001 — edited Nov 9 2005
I'm trying to set the property java.library.path at runtime so I don't have to drop my .dll in the regular system path for a System.loadLibrary to work. This is the sequence I use in a static initilizer:

System.setProperty("java.library.path", "C:\\");
System.loadLibrary("DialButton");

When I put the file DialButton.dll in C:\ I get an java.lang.UnsatisfiedLinkError, but when I put it in D:\WINNT it works fine. I would expect it to do the opposite because presumably I blew away the real java.library.path when I ran setProperty and it shouldn't know to check D:\WINNT.

I'm trying to keep my application install clean and use a directory structure that maintains all of the required files without cluttering system directories. I also want to dynamically load JNI libraries for a distributed application after copying them to the local machine.

Thanks in advance,
Ryan
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 7 2005
Added on Jun 9 2001
16 comments
5,874 views