Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JNA java.lang.UnsatisfiedLinkError and The specified module could not be found

I'm putting together a jar that will let me call commands only available to natives (the jar uses natives rather then the actual program). Now I ran into a problem, whenever I load the DLL. Here is the error:

Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'myDLL.dll': The specified module could not be found.

at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:194)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:283)
at com.sun.jna.Library$Handler.<init>(Library.java:142)
at com.sun.jna.Native.loadLibrary(Native.java:368)
at com.sun.jna.Native.loadLibrary(Native.java:353)
at src.NativeBridgeJar.<clinit>(NativeBridgeJar.java:6)
at src.Main.main(Main.java:6)

I don't why what the cause of this error would be. I made sure I set the native library path to the folder with the native. Does anyone have an idea?

like image 324
user2306911 Avatar asked Oct 21 '25 04:10

user2306911


1 Answers

A) when you call Native.loadLibrary(), you may provide a shorthand name ("myDll"), a filename ("myDll.dll"), or the absolute path of the shared library ("c:/users/me/myDll.dll").

B) If you don't provide an absolute path to the library, you may tell it where to load the DLL by specifying jna.library.path, or making it available on java.library.path (there are other options described in the NativeLibrary javadoc).

like image 60
technomage Avatar answered Oct 23 '25 17:10

technomage