Search code examples
javadlljava-native-interface

How to debug a Java UnsatisfiedLinkError?


On Windows (everything works on OSX), I have a Java library which depends on a native library. I load this individual library with System.load(), and right after an UnsatisfiedLinkError: Can't find dependent libraries exception shows up.

The native library has no particular dependencies – it only relies on system libraries, as confirmed by dependency walker (where it's perfectly ok). I have tried using a x86 version with an x86 JRE and an x64 version with an x64 JRE, having faced no change at all.

After spending two days after this, I would like to know if there is more information that can be obtained from this exception: what library is it trying to load, for instance?


Solution

  • I was using System.load() on an arbitrary file name. For it to work, it apparently requires the explicit extension .dll.