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!

Absolute Path in System.loadLibrary()

843829Jan 28 2002 — edited Jan 28 2002
Hi JNI Gurus:

I finally give in ... and call for help ... after wasting a whole day, trying, searching the forums. Here's the problem:

I am loading native files in my applications. Everything works when I place the native libraries (.dlls) in a folder accessible to the PATH variable. However, I am not happy with it, I would like to put the native dlls in a subfolder of my application and not modify the PATH variable. Now, going through the forums posts, I have learnt that I can specify the full path of the dll in System.loadLibrary(). However, it doesn't work for me. Here are the results:

1. System.loadLibrary("mydll"); works fine when in PATH

2. System.loadLibrary("C:\mydlls\mydll"); erorrs - invalid escape character ... ofcourse!

3. System.loadLibrary("C:\\mydlls\\mydll"); erorrs - directory separator should not appear in library name

4. System.loadLibrary("C:/mydlls/mydll"); erorrs - C:/mydlls/mydll in java.library.path

What am I doing wrong here? Please help!

Kamran
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 25 2002
Added on Jan 28 2002
2 comments
2,558 views