Unable to resolve java.lang.UnsatisfiedLinkError ?!

Hi:

My java code uses native libraries (in C++). In my IDE (eclipse) I specified the path of this native library. But I get java.lang.UnsatisfiedLinkError. I tried to add the path as VM argument. Then it says main not found and "java.lang.NoClassDefFoundError". I went through the thread that talks about these in here. But I am not able to resolve the problem. Could someone suggest me how to avoid this error?

Thanks

AVS

[447 byte] By [pavankumara] at [2007-10-3 0:15:47]
# 1

I don't know if eclipse has some auto generated java code for JNI, anyway if you follow those step to step procedures you can't make mistakes...

http://www.javaworld.com/javaworld/jw-03-2001/jw-0316-itw-jni.html

The gray table almost at the end is very useful and clear!

if still have problems paste some code :-)

opiua at 2007-7-14 17:06:27 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2

> Hi:

>

> My java code uses native libraries (in C++). In my

> IDE (eclipse) I specified the path of this native

> library. But I get java.lang.UnsatisfiedLinkError. I

> tried to add the path as VM argument. Then it says

> main not found and "java.lang.NoClassDefFoundError".

> I went through the thread that talks about these in

> here. But I am not able to resolve the problem. Could

> someone suggest me how to avoid this error?

>

It isn't clear what you are doing.

The JNI library must be loaded via the java System.load() or System.loadLibrary(). The second is normally the one that should be used. It isn't going to work if that doesn't happen.

The search strategy varies by OS/platform but the basic idea is that the library must be in the 'shared library path' to be found if loadLibrary() is used. In general 'path' only works on windows. I am not sure that there is anyway to add 'path' (for windows) as a VM argument, because basically the OS sets that when a process starts.

Finally, if the method signatures do not match then it will not be able to resolve the methods.

Class not found means that you did something to classpath. And classpath has nothing to do with JNI libraries.

jschella at 2007-7-14 17:06:27 > top of Java-index,Java HotSpot Virtual Machine,Specifications...