Wednesday, March 7, 2012

java.lang.UnsatisfiedLinkError: no dll in java.library.path Exception Java

Java - Exception in thread "main" java.lang.UnsatisfiedLinkError: no dll in java.library.path

"Exception in thread "main" java.lang.UnsatisfiedLinkError: no dll in java.library.path" is a frusttrating exception you will get if your application is using native library from java.lang.System.loadLibarray() method. I was writing  some Tibco Rendezvous Messaging code which uses some windows specific dll and I got "java.lang.UnsatisfiedLinkError: no *.dll in java.library.path". here we will see real cause of "Exception in thread "main" java.lang.UnsatisfiedLinkError: no dll in java.library.path" and how to fix this Exception in Java.

Cause of java.lang.UnsatisfiedLinkError: no dll in java.library.path:

Exception in thread When you load native library like .so on Linux or .dll on Windows using System.loadLibrary() it looks for those shared library in both PATH environment variable and java.libarary.path system property, if it doesn't find shared library it throws "Exception in thread "main" java.lang.UnsatisfiedLinkError: no in java.library.path". now trick is that in Windows it picks up dll form System32 folder and most of the time System32 exits in path so we don't usually come up with this problem. anyway if you are repeatedly getting this Error than you can try following step which may help you to resolve java.lang.UnsatisfiedLinkError in your java application.

Solution of "Exception in thread "main" java.lang.UnsatisfiedLinkError: no dll in java.library.path"

1) Check your PATH for Java , whether it contains required dll or not.
2) Verify your java.library.path in case you have set it for required dll.
3) Run your java application with command : java -Djava.library.path= "your dll path"
4) Try specifying base name for the library and loading library using System.loadLibaray("name) where name is without dll.

5) Linux loads dynamic linked library(.so) from LD_LIBRARY_PATH so you may want to have your shared library directory included in LD_LIBRARY_PATH e.g.

6) load library by providing absolute path like "C:/WINNT/system32/digest.dll"

export LD_LIBRARY_PATH=/shared library (.so)

Main point is JVM should find your dll and providing explicitly path with -Djava.library.path always help me.

Some other points worth noting while working with System dependent libraries:
1) They make java code platform dependent.
2) System.loadLibrary() is equivalent to Runtime.getRuntime.loadLibary().
3) load System.loadLibary(libary) in static initalizer block so that it only gets loaded when containing class gets loaded and
avoid reloading of it.

Another worth noting point is the actual error message java.lang.UnsatisfiedLinkError throws:

if it shows  "Exception in thread "main" java.lang.UnsatisfiedLinkError: no dll in java.library.path"  means JVM is not able to locate and load library.

if it shows thread "main" java.lang.UnsatisfiedLinkError: com......' i.e. prints class or method name than may be something is wrong with library itself like half copied dll.

Some time you may also get
Exception in thread "main" java.lang.UnsatisfiedLinkError: Expecting an absolute path of the library: digest.dll
        at java.lang.Runtime.load0(
        at java.lang.System.load(
to solve this just provide absolute path for library and you will be fine.

That’s all on how to fix  Exception in thread "main" java.lang.UnsatisfiedLinkError: no dll in java.library.path" , share your experience if you have faced this java.lang.UnsatisfiedLinkError before.

Other Java debugging tutorial you may like


Anonymous said...

Hello every one ,

I have installed a dtSearch Engine on my PC and when i run the application i got some error on console

Exception in thread "Thread-5" java.lang.UnsatisfiedLinkError: C:\Program Files\dtSearch Developer\bin\dtsjava.dll: The operating
system cannot run %1

I have already set the environment variables,still I got this error.please give me the appropriate solutions.

Anonymous said...

I am getting "java.lang.UnsatisfiedLinkError: no ocijdbc9 in java.library.path" and I have Oracle latest version installed on machine, Can you please help, what is wrong ? Why its not able to find suitable driver.

Sayan Guharoy said...

have look at this thread

unsatisfiedlinkerror no in java.library.path

Pratap said...

What does java.library.path means? is it a environment variable or a System property? Also, How to set java.library.path in Eclipse, Netbeans or IntelliJ IDE? I have an application, which uses native library, which is different in windows and Mac OSX, and I need to run that program in Eclipse, please help.

Roop said...

Is there way to fix java.lang.UnsatisfiedLinkError, without restarting Java application. Can we catch this error and then try to load native library from alternate directory?

Anonymous said...

Hello everyone,

I am facing same error in my project while loading the jni library.
i am working with eclipse in linux and i have use the
path to load the library.
As my jni library is in resources folder so the path is given.
but it give the error...
My project contains number of packages.
whethr that affect the library path or not?
please help me...

Thanks in advance

Gauri said...

java.lang.UnsatisfiedLinkError: Library foo not found tibrvnnative error comes because tibco native libraries are not accessible to your java program. check which directory they are located, you might not have right permissions. On Android, this error can come due to various reasons one of them is not compiled using NDK.

Anonymous said...

One reason for java.lang.UnsatisfiedLinkError is class is not available for linking phase, which happens after loading of class. We had faced the same issue, where we are loading class from file system and database together. We could load them but not link them.

Anonymous said...

Hello there, I am getting following error in my application, which uses Tibco RV for communication between different modules.

java.lang.UnsatisfiedLinkError: Native library not found. Tried to load tibrvnative64 and tibrvnative
at com.tibco.tibrv.Tibrv.loadNativeLibrary(
at com.tibco.tibrv.Tibrv.(
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(
at com.tibco.tibrv.TibrvMsg.(

Any idea how to fix this error?

Anonymous said...

I am getting following error "tibrvnative.dll: Can't find dependent libraries" while setting up Tibco RV in windows 8 machine. I have included tibco binaries in System path and also provided native library location inside my project in Eclipse, but still it's not able to find all dependency.

Exception in thread "main" java.lang.UnsatisfiedLinkError: Native library not found. Tried to load tibrvnative64 and tibrvnative
at com.tibco.tibrv.Tibrv.loadNativeLibrary(
at com.tibco.tibrv.Tibrv.(

Caused by: java.lang.UnsatisfiedLinkError: no tibrvnative in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at com.tibco.tibrv.Tibrv.loadNativeLibrary(
... 7 more

That was before adding tibco installation bin directory in native library location in project settings in Eclipse, after that we are getting following error :
Caused by: java.lang.UnsatisfiedLinkError: C:\tibco\tibrv\8.4\bin\tibrvnative.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(Unknown Source)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at com.tibco.tibrv.Tibrv.loadNativeLibrary(
... 7 more

My machine is Windows 8 64 bit and I am using Java 7 update 30 64 bit version.

David said...

@Anonymous, you can check following things to fix java.lang.UnsatisfiedLinkError: Native library not found
1) Make sure you have tibco installation directory in your PATH environment variable e.g. TIBCO_HOME/bin, which contains all dll required e.g. tibrvnative.dll

2) Make sure you have relevant JAR file in classpath e.g. tibrvnative.jar
3) Check if you have installed correct package, e.g. use tibco x86 installer for 32-bit systems, and tibco x64 installer for 64-bit systems.
4) If you are running your Java program, which uses Tibco on Eclipse than add tibco/bin as native library location in project build settings, in Solaris or Linux you can specify LD_LIBRARY_PATH environment variable to include those path.

Let me know if this helps

Anonymous said...

I am still getting tibrvnative.dll: Can't find dependent libraries, tried different things like reinstalling after uninstallation, different Java version etc, I also checked PATH, CLASSPATH and native library location but still getting this error.

Anonymous said...

Try running your program with 32-bit JVM rather than 64-bit JVM on x64 machine, you may be able to solve tibrvnative.dll: Can't find dependent libraries error.

raja gopal said...

iIs beceuse of 64 bit operating system..jmf doesnt work on 64 bit os....

affittoVialeCaGranda said...


I cant get it solved:

Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa
Caused by: java.lang.RuntimeException: Application launch error
at com.sun.javafx.application.LauncherImpl$ Source)
at Source)
Caused by: java.lang.UnsatisfiedLinkError:
at Method)
at Source)
at Source)
at com.sun.javafx.application.PlatformImpl.runLater(Unknown Source)
at com.sun.javafx.application.PlatformImpl.runAndWait(Unknown Source)
at com.sun.javafx.application.PlatformImpl.tkExit(Unknown Source)
at com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown So
at com.sun.javafx.application.LauncherImpl.access$000(Unknown Source)
... 2 more

Please Help me

Aye Thandar said...

java.lang.UnsatisfiedLinkError: no ST3J in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at client.ST3.(
at client.EncryptDecrypt.(
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(
at org.apache.catalina.core.StandardWrapper.loadServlet(
at org.apache.catalina.core.StandardWrapper.allocate(
at org.apache.catalina.core.StandardWrapperValve.invoke(
at org.apache.catalina.core.StandardContextValve.invoke(
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(
at org.apache.catalina.core.StandardHostValve.invoke(
at org.apache.catalina.valves.ErrorReportValve.invoke(
at org.apache.catalina.valves.AccessLogValve.invoke(
at org.apache.catalina.core.StandardEngineValve.invoke(
at org.apache.catalina.connector.CoyoteAdapter.service(
at org.apache.coyote.http11.Http11Processor.process(
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$ Source)
at Source)

Please help me!

I already check java path.

Anonymous said...

I am also getting dll: can't find dependent library error while runing Java application which uses JNI and has 32 bit and 64 bit DLL. Initially I got error related to 32-bit vs 64-bit DLL vs JVM but after resolving that I stuck with this one.

Anonymous said...

@Aye, try running your application with java -Djava.library.path="path to directory of native libraries", also add that directory into PATH variable, that should do the job

Anonymous said...

This error also depends upon whether you are using System.load() or System.loadLibrary() method, because in case of load(), you give absolute path of native libraries while in case of loadLibrary() Java uses variable "java.library.path" to find native libraries.

Post a Comment