tags:

views:

106

answers:

2

Hey guys,

I have a problem relative to JNI and Java. Here is the thing : the client wants us to install a certain app on his system. This app uses native libs, but the client does not want to put these libs in his system folder, for reasons I don't really know or understand, but can't change.

To circumvent thius problem, I tried to launch the JVM with -Djava.library.path, putting the right dlls in it. But the fact is, I have a UnsatisfiedLinkError when I try to launch my project. From what I can see, the problem is not in the main dll called (because the file obviously exists, I saw it when debugging), I think that must be some of the libs linked by this first dll that are problematic, but I don't know how to find what dll is missing.

Any idea on how to solve this problem ?

+2  A: 

My first port of call (even for JNI debugging) is always Dependency Walker. If nothing else, it will tell you every other DLL that your DLL depends on.

ldd is the equivalent for Linux.

Adam Batkin
It looks really promising. I'll try tomorrow, if this works you're my savior.
Valentin Rocher
And of course, for all our Linux readers, it's `ldd` ;-)
Matt Solnit
@Adam Batkin : took the liberty of adding ldd to your reponse, for the sake of future readers, I hope you won't mind.
Valentin Rocher
A: 

I think that parameter is for specifying directories, not files. So if your dll is c:\mylibs\lib1.dll then you have to set its value to c:\mylibs.

I don't know if it allows multiple paths. Let me check.

Edit

That parameter do allow multiple paths.

See section 2.7 in http://java.sun.com/docs/books/jni/html/start.html

It doesn't specify the format but I imagine you can use the same separator than in classpath. It says you can also use the PATH system variable.

helios
tried multiple paths, put the dirs. It's just that something is still missing.
Valentin Rocher
Oh, ok. And the exception don't say "*ModuleName* missing"?
helios
No, it said it has a problem with the class I know exists, but I don't know more details.
Valentin Rocher
-class+lib, obviously.
Valentin Rocher