java.lang.UnsatisfiedLinkError: no dll in java.library.path - Cause and Solution

"Exception in thread "main" java.lang.UnsatisfiedLinkError: no dll in java.library.path" is one of the frustrating error you will get if your application is using native libraries e.g. .DLL in Windows or .SO files in Linux. Java loads native libraries at runtime from either PATH environment variable or location specified by java.library.path system property depending upon whether your Java program is using System.load() or java.lang.System.loadLibarray() method to load native libraries. If Java doesn't find them due to any reason it throws "java.lang.UnsatisfiedLinkError: no dll in java.library.path". Some of the most common UnsatisfiedLinkError is "java.lang.UnsatisfiedLinkError: no ocijdbc10.dll in java.library.path" and "java.lang.UnsatisfiedLinkError: no ocijdbc11.dll in java.library.path", which comes when you try to connect to Oracle 10g or 11g database from Java program using OCI JDBC driver. If you write games in Java program using lwjgl then you might have seen this error as well "java.lang.unsatisfiedlinkerror no lwjgl in java.library.path", which comes when Java doesn't find native component of lwjgl.jar library. It also common on Java application which uses JNI to link some core legacy libraries in C and C++.   I first encounter this error while writing  some Tibco Rendezvous Messaging code which uses some windows specific dll, which is installed as part of TIBCO RV installation. I was getting "java.lang.UnsatisfiedLinkError: Native library not found" which was caused by "java.lang.UnsatisfiedLinkError: no tibrvnative in java.library.path". I wasted lot of hours playing with PATH, java.library.path and others only to learn from experience. Here you will learn root cause of "Exception in thread "main" java.lang.UnsatisfiedLinkError: no dll in java.library.path" and learn 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 libraries like .so on Linux or .dll on Windows using System.loadLibrary() Java looks for those shared library in both PATH environment variable and java.library.path system property, If it doesn't find shared library it throws "Exception in thread "main" java.lang.UnsatisfiedLinkError: no XXX dll 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, but this work only if program has put a copy of dll in that folder, for example corporate installation of Tibco Rendezvous does put tibrvnative.dll in System 32 folder, but if you install let's say Oracle 10g or 11g, the native library ocijdbc11.dll is installed at custom location usually on ORACLE_HOME/bin directory. It also worth identifying is whether your application or third party library which is throwing this error e.g. Oracle JDBC driver is using System.load() or System.loadLibrary() method. You can also identify this by looking at error message, if you see java.library.path in error message means it surely using System.loadLibrary(). This message also tells that program has provided that system property and program is not looking on PATH for native libraries. Anyway if you are repeatedly getting this Error than you can try following steps which may help you to resolve java.lang.UnsatisfiedLinkError in your Java application.

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

As error clearly says that Java is not able to find some native library required, it could mean either library is not exists or Java is not able to locate them due to incorrect PATH or java.library.path. Remember, when you don't provide this system property, by default Java looks at PATH for native libraries in Windows operating system and on LD_LIBRARY_PATH in Linux. Though its good practice to provide this PATH and use System.loadLibrary() method to have a consistent location for native libraries in all platforms. 

Here are couple of things you can do to solve error "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.

export LD_LIBRARY_PATH=/shared library (.so)

6) load library by providing absolute path like "C:/WINNT/system32/digest.dll" by using System.load("Path of native library") method. 

Main point is JVM should find your dll and providing explicitly path with -Djava.library.path always help me.
java.lang.UnsatisfiedLinkError: no dll in java.library.path solution

Still getting java.lang.UnsatisfiedLinkError

If you are still getting Exception in thread "main" java.lang.UnsatisfiedLinkError: no dll in java.library.path, even after adding JAR into classpath and adding native library into PATH environment variable and providing system property java.library.path pointing to location of native library location then there is must be some directory in your PATH which is not resolved correctly.

I was frustrated after trying every method to solve this error, when I noticed following error, just before this error comes :

"The system cannot find the path specified" when I printed PATH variable.

since I was doing set PATH= %PATH%; (location of native library)

System was not able to navigate to that directory because of those non existent path. In order to solve that I just did opposite, added location of native library in front of PATH and it worked like a charam

set PATH = {location of native dll}; %PATH%

So pay attention to your PATH variable. It often happens PATH keeps directories of uninstalled program which abruptly breaks and System stop searches further. This issue can also come in Linux and you can solve it just like this, add your native library as first entry in PATH environment variable.

Now bit of theory, if you use System.loadLibrary() then it searches native library in location specified by java.library.path but if you don't provide that system library then it defaults to PATH environment variable.

Things to Remember 

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, though it could also lead to ExceptionInitializerEror and NoClassDefFoundError, if native libraries are not found. 

4) Another worth noting point is paying attention on exact 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(Runtime.java:767)
        at java.lang.System.load(System.java:1003)
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 troubleshooting tutorials and some debugging tips for Eclipse IDE user, you may like :
  1. How to fix java.lang.UnSupportedClassVersionError in Java (Solution)
  2. How to debug Java program in Eclipse – Java Debugging tips (Tips)
  3. How to remote debug Java application in Eclipse (Steps)
  4. Difference between ClassNotFoundException vs NoClassDefFoundError in Java (difference)
  5. How to resolve java.lang.ClassNotFoundException in Java? (solution)
  6. How to fix Java.lang.OutOfMemroyError in Tomcat Server? (solution)
  7. How to solve Invalid Column Index Exception in Java JDBC? (solution)
  8. How to solve java.util.nosuchelementexception hashtable enumerator? (solution)
  9. How to fix java.lang.nosuchmethoderror main in Java? (solution)


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(Tibrv.java:392)
at com.tibco.tibrv.Tibrv.(Tibrv.java:79)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:190)
at com.tibco.tibrv.TibrvMsg.(TibrvMsg.java:25)

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(Tibrv.java:392)
at com.tibco.tibrv.Tibrv.(Tibrv.java:79)

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(Tibrv.java:389)
... 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(Tibrv.java:389)
... 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$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.UnsatisfiedLinkError: com.sun.glass.ui.win.WinApplication._
at com.sun.glass.ui.win.WinApplication._invokeLater(Native Method)
at com.sun.glass.ui.Application.invokeLater(Unknown Source)
at com.sun.javafx.tk.quantum.QuantumToolkit.defer(Unknown 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.(ST3.java:151)
at client.EncryptDecrypt.(EncryptDecrypt.java:49)
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(DefaultInstanceManager.java:119)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1073)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:824)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:403)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:301)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:162)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown 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