Reputation: 63
I have a C++ .dll
in my java Spring Boot project.
Everything looks good and method from .dll
is called when:
mvn pack & java -jar target/Project-0.0.1-SNAPSHOT.jar
I tried to copy project to another machine and I got this problem:
When I run application from IDE everything is ok
When I run same command on project mvn pack & java -jar target/Project-0.0.1-SNAPSHOT.jar
and it's called .dll
method it crash with message error:
java.lang.UnsatisfiedLinkError: The specified module could not be found.
at com.sun.jna.Native.open(Native Method) ~[jna-4.1.0.jar!/:4.1.0 (b4)]
at com.sun.jna.Native.open(Native.java:1759) ~[jna-4.1.0.jar!/:4.1.0 (b4)]
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:260) ~[jna-4.1.0.jar!/:4.1.0 (b4)]
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:398) ~[jna-4.1.0.jar!/:4.1.0 (b4)]
at com.sun.jna.Library$Handler.<init>(Library.java:147) ~[jna-4.1.0.jar!/:4.1.0 (b4)]
at com.sun.jna.Native.loadLibrary(Native.java:412) ~[jna-4.1.0.jar!/:4.1.0 (b4)]`.
Note: I have Microsoft Visual C++ 2017 Redistributable on both machines.
If I move .dll file in project root directory it works.
Upvotes: 1
Views: 568
Reputation: 12583
You are using JNA inside your project. JNA requires some native libraries be properly installed. E.g. it needs jnidispatch.dll
for Windows platform.
For your case, you need to download the required native libs, e.g. https://github.com/java-native-access/jna/blob/master/lib/native/win32, and put it into a directory where can be searched by your JAVA.
Upvotes: 1