Problem with java.library.path

A

Aaron Boxer

Hello,

I am working with JDK 1.4.2 on windows 2000.

I have a JNI dll in the folder c:\src\bin

So, I make the following call:

java -classpath MyClassPath -Djava.library.path=c:\src\bin MyApp.app

But, the directory is ignored. and I get an Unsatisfied link error.

If I put "c:\src\bin" in the PATH, then everything is fine.


Any ideas?

Thanks.

Aaron Boxer
 
S

Steve W. Jackson

Aaron Boxer said:
:Hello,
:
:I am working with JDK 1.4.2 on windows 2000.
:
:I have a JNI dll in the folder c:\src\bin
:
:So, I make the following call:
:
:java -classpath MyClassPath -Djava.library.path=c:\src\bin MyApp.app
:
:But, the directory is ignored. and I get an Unsatisfied link error.
:
:If I put "c:\src\bin" in the PATH, then everything is fine.
:
:
:Any ideas?
:
:Thanks.
:
:Aaron Boxer

Some idiot once upon a time decided that Windows would use those dumb
"\" characters instead of real, regular slashes. Since virtually every
other environment uses those for escaping special characters, and since
the value you're passing is a Java String, you likely need to escape
them by doubling them up. But you could also save yourself some grief
if you understand how the loading of JNI libraries works.

On Windows, if you put the DLL file in the very same directory where the
launched application starts from (the directory which is returned via
the user.dir system property), there's no problem. It's automatically
found. On the other hand, instead of using System.loadLibrary("name"),
you could just use System.load("filename.dll") instead. It lets you
specify the absolute or relative path without problems.

= Steve =
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,140
Latest member
SweetcalmCBDreview
Top