Preparing for Java and Spring Boot Interview?

Join my Newsletter, its FREE

Thursday, June 16, 2022

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 errors you will get if your application is using native libraries like the 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 a native component of the lwjgl.jar library. It also common on Java application which uses JNI to link some core legacy libraries in C and C++.   

I first encountered this error while writing some Tibco Rendezvous Messaging code which uses some windows specific dll, which is installed as part of the 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 a lot of hours playing with PATH, java.library.path, and others only to learn from experience. Here you will learn the 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:

When you load native libraries like .so on Linux or .dll on Windows using System.loadLibrary() Java looks for those shared libraries 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 from System32 folder and most of the time System32 exists 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, the 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 like  Oracle JDBC driver is using System.load() or System.loadLibrary() method. 

You can also identify this by looking at the 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 the program is not looking for PATH for native libraries. 

Anyway if you are repeatedly getting this error then you can try following steps which may help you to resolve java.lang.UnsatisfiedLinkError in your Java application.

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

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

Exception in threadAs 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 it's good practice to provide this PATH and use System.loadLibrary() method to have a consistent location for native libraries on all platforms. 

Here are a 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 a base name for the library and loading library using System.loadLibaray("name) where the name is without dll.

5. Linux loads dynamically 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. 

The main point is JVM should find your dll and providing an explicit 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 the native library into PATH environment variable and providing system property java.library.path pointing to the 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 the 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 the native library)

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

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

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

Now a bit of theory, if you use System.loadLibrary() then it searches native library in the 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(library) in static initializer 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 to 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 then maybe something is wrong with the library itself like half copied dll.

Sometimes 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". I have shared all the information I know about UnsatisfiedLinkError in Java like what causes this error and how you can fix this error. I have spent countless hours to figuring out the solution but you can learn from my experience and avoid that. You can also share your experience if you have faced this java.lang.UnsatisfiedLinkError before.

Other Java troubleshooting tutorials and some debugging tips for Eclipse IDE users, 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)
  10. How to fix Error creating a bean with name 'dataSource' defined in class path resource DataSourceAutoConfiguration [solution]
  11. @Autowired - No qualifying bean of type found for dependency in Spring Boot? [Solution]
  12. How to fix "No Property Found for Type class " Exception in Spring Data JPA [Solved

Thanks for reading this article. If this Java troubleshooting guide helped you to fix UnsatisifiedLinkError in your application, please share this with your friends. If you are still getting error and not able to solve, feel free to drop a note with details like what have you tried so far. 


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.

Unknown 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

Unknown 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.

Anonymous said...

java.lang.UnsatisfiedLinkError: Can't find dependent libraries -> try to launch your project with jre and not the jdk. It works for me.

Unknown said...

Thank you so much! I've spent a few hours trying to invoke System.loadLibaray(name) with .dll at the end. Your article is brilliant!

Chetan said...

I am facing this problem please solve my problem

javaLibPath : C:\Users\Chetan.Gujar\AppData\Local\CallPhotoShopWithResponse\app
loading core from C:/Users/Chetan.Gujar/AppData/Local/CallPhotoShopWithResponse/app/lib/jni4net.n-
loading jni4net.n-, Version=, Culture=neutral, PublicKeyToken=134a23405600bab4 from C:\Users\Chetan.Gujar\AppData\Local\CallPhotoShopWithResponse\app\lib\jni4net.n-0
loaded jni4net.n-, Version=, Culture=neutral, PublicKeyToken=134a23405600bab4 from C:\Users\Chetan.Gujar\AppData\Local\CallPhotoShopWithResponse\app\lib\jni4net.n-0.
Initialized jni4net core
core loaded from C:/Users/Chetan.Gujar/AppData/Local/CallPhotoShopWithResponse/app/lib/jni4net.n-
clr.version :v4.0.30319
clr.arch :32bit
java.home :C:\Program Files (x86)\Java\jre1.8.0_121
java.version :1.8.0_121 :32
loading helloworld.j4n, Version=, Culture=neutral, PublicKeyToken=null from D:\JNI PHOTOSHOP\CallPhotoShopWithResponse\helloworld.j4n.dll
loaded helloworld.j4n, Version=, Culture=neutral, PublicKeyToken=null from D:\JNI PHOTOSHOP\CallPhotoShopWithResponse\helloworld.j4n.dll
Exception in thread "JavaFX Application Thread" Exception in thread "main" java.lang.UnsatisfiedLinkError: helloworld.Hello.display(Ljava/lang/String;)Z
at helloworld.Hello.display(Native Method)
at dcalbum.DCAlbum.(
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplicationWithArgs$156(
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(
at com.sun.javafx.application.PlatformImpl.lambda$null$173(
at Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(
at Method)
at Source)
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 sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
Caused by: java.lang.NullPointerException
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(
at com.sun.javafx.application.LauncherImpl.launchApplication(
... 5 more

Unknown said...

java.lang.UnsatisfiedLinkError: no iDRMSGEBridgeDll in java.library.path
at java.lang.ClassLoader.loadLibrary( ~[na:1.7.0_79]
at java.lang.Runtime.loadLibrary0( ~[na:1.7.0_79]
at java.lang.System.loadLibrary( ~[na:1.7.0_79]

I Checked the Environment variable. and its ok as well.

javin paul said...

@Nikhil, do you see this DLL in your PATH "iDRMSGEBridgeDll"

Post a Comment