"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 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 encounterd 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 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 loadnative 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, 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 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.UnsatisfiedLinkErrorin 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 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" :

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 explicitly path with -Djava.library.path always help me.

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

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.

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.

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 -Djava.library.path="${workspace_loc}/SampleApp/resources:${env_var:PATH}"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...

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.

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.

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)

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

@Anonymous, you can check following things to fix java.lang.UnsatisfiedLinkError: Native library not found1) 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.jar3) 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.

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.

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)

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.

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.

java.lang.UnsatisfiedLinkError: no iDRMSGEBridgeDll in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1886) ~[na:1.7.0_79] at java.lang.Runtime.loadLibrary0(Runtime.java:849) ~[na:1.7.0_79] at java.lang.System.loadLibrary(System.java:1088) ~[na:1.7.0_79] at com.birlasoft.ci.iDRMSGEBridgeDll.callOcr(iDRMSGEBridgeDll.java:81)