开发者

What is the cause of an UnsatisfiedLinkError?

开发者 https://www.devze.com 2022-12-23 12:17 出处:网络
When i am trying to run my program it is giving the following error Exception in thread \"main\" java.lang.UnsatisfiedLinkError: no jacob-1.14.3-x86 in java.library.path

When i am trying to run my program it is giving the following error

       Exception in thread "main" java.lang.UnsatisfiedLinkError: no jacob-1.14.3-x86 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1030)
at com.jacob.com.LibraryLo开发者_开发知识库ader.loadJacobLibrary(LibraryLoader.java:184)
at com.jacob.com.JacobObject.<clinit>(JacobObject.java:108)
at javaSMSTest.main(javaSMSTest.java:18)

please help


From the Javadoc:

Thrown if the Java Virtual Machine cannot find an appropriate native-language definition of a method declared native.

It is an error related to JNI. loadJacobLibrary is trying to load the native library called jacob-1.14.3-x86 and it is not found on the path defined by java.library.path. This path should be defined as a system property when you start the JVM. e.g.

-Djava.library.path=<dir where jacob library is>

On Windows, the actual native library file will be called jacob-1.14.3-x86.dll while on Linux it would be called libjacob-1.14.3-x86.so


You need the jacob-1.14.3-x86 library on your java library path.

On windows, this would be jacob-1.14.3-x86.dll.

This is a binary file which is used by java to run native methods. It's probably required by some library (jar) you're using.

In here you can see not only a jar, but also the binary required by the jar. Pick the one for your platform.


To quote http://www.velocityreviews.com/forums/t143642-jni-unsatisfied-link-error-but-the-method-name-is-correct.html:

There are two things that cause UnsatisfiedLinkError. One is when System.loadLibrary() fails to load the library, the other is when the JVM fails to find a specific method in the library. The text of the error message itself will indicate which is the case...

The error which you describe clearly cannot find the library at all. As the others have said, include it in your Java library path.

The other error—when the library can be found but the method within the library is not found—looks as follows:

java.lang.UnsatisfiedLinkError: myObject.method([Ljava/lang/Object;)V

In this case you either have the wrong method name, or will have to go back and add the method and recompile the code...

0

精彩评论

暂无评论...
验证码 换一张
取 消