UnsatisfiedLinkError
Java Programming Language
Severity: CriticalWhat Does This Error Mean?
UnsatisfiedLinkError means Java tried to load a native library and could not find it. Native libraries are platform-specific files like .dll (Windows) or .so (Linux). Without them, any code that calls into that library will fail immediately.
Affected Models
- Java 8
- Java 11
- Java 17
- Java 21
- Android (Java/Kotlin)
Common Causes
- The native library file (.dll, .so, .dylib) is missing from the system
- The library exists but is not on the java.library.path
- A 32-bit library is being loaded by a 64-bit JVM, or vice versa
- The library file is present but depends on another library that is also missing
- The method signature in the native code does not match the Java declaration
How to Fix It
-
Read the full error message — it names the library Java failed to load.
Example: UnsatisfiedLinkError: no sqlite4java-win32-x86 in java.library.path
-
Verify the native library file exists on the machine.
Search for the .dll or .so file. If it is absent, you need to install the dependency or add it to your project.
-
Add the library's folder to java.library.path when launching the JVM.
Use the JVM flag: -Djava.library.path=/path/to/libs
-
Check that the library architecture matches your JVM.
Run java -version to see if your JVM is 64-bit. Use a matching 64-bit version of the native library.
-
If using a build tool like Maven or Gradle, verify the native classifier is included.
Many libraries publish native artifacts with classifiers like natives-windows or natives-linux. Make sure the correct one is in your dependencies.
When to Call a Professional
If you are deploying software that uses native libraries, this usually requires a sysadmin or DevOps engineer. Setting up library paths on production servers is outside the scope of typical application code.
Frequently Asked Questions
What is a native library in Java?
A native library is code written in C or C++ and compiled for a specific operating system. Java calls into it using JNI (Java Native Interface). Examples include graphics drivers, hardware interfaces, and performance-critical tools.
How do I find what java.library.path is set to?
Add this line to your Java code: System.out.println(System.getProperty("java.library.path")). This prints every directory Java searches for native libraries at runtime.
Can I fix this without changing the JVM launch flags?
Yes — you can call System.load() with an absolute path to the library file. This bypasses the java.library.path search entirely. It is useful for quick debugging but not ideal for production.