Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the cause of an UnsatisfiedLinkError?

Tags:

java

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.LibraryLoader.loadJacobLibrary(LibraryLoader.java:184)
at com.jacob.com.JacobObject.<clinit>(JacobObject.java:108)
at javaSMSTest.main(javaSMSTest.java:18)

please help

like image 884
GuruKulki Avatar asked Mar 15 '10 10:03

GuruKulki


People also ask

What is UnsatisfiedLinkError?

public class UnsatisfiedLinkError extends LinkageError. Thrown if the Java Virtual Machine cannot find an appropriate native-language definition of a method declared native .

What does system loadLibrary do?

The System. loadLibrary() takes as parameter a library name, locates a native library that corresponds to that name, and loads the native library. For information about how a native library is located by the System.

How do I find the Java library path in Linux?

Use java -XshowSettings:properties to show the java. library. path (and others) value. Thanks Jose, this helped me.


2 Answers

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

like image 118
Mark Avatar answered Nov 15 '22 21:11

Mark


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.

like image 30
extraneon Avatar answered Nov 15 '22 22:11

extraneon