How to fix Java JNI DLL dependencies
I have a Java Application which has to load an DLL with a few dependencies. I copied all required DLLs in the same folder. The DLL I was set up uses the SeeingMachine FaceApi libraries. Now when I'm starting the Java application I will get an error the my DLL can't find the dependencies:
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\[..]\bin_dbg\HeadTrackerDLL.dll: Can't find dependent libraries at java.lang.ClassLoader$NativeLibrary.load(Native Method) 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 Tracker.<clinit>(Tracker.java:12) at TrackerControls.<init>(TrackerControls.java:18) at Main.main(Main.java:6)
How can I solve the problem? Because Dependency Walker does not show any error. And I don't wanna load ALL DLL files manually.
So i think i fixed my problem with the mt.exe tool.
mt.exe -manifest HeadTrackerDLL.dll.intermediate.manifest -outputresource:HeadTrackerDLL.dll;
With this codeline the manifest file and the dll file will be packed into the dll file so all dependencies located.
My application runs. I hope this was the solution.