I am trying to import a .dll in java (java 11) with JNA. I compiled the dll's myself (using mingw64), verified that they are 64 bit and made sure all dependencies (i.e. linked dlls) are available in the same path. However, I still get the following error message. What am I doing wrong?
java.lang.UnsatisfiedLinkError: Unable to load library 'libClp-0':
The specified module could not be found.
The specified module could not be found.
The specified module could not be found.
Native library (win32-x86-64/libClp-0.dll) not found in resource path
The dll's regard COIN-OR's CLP solver. As mentioned, I have compiled them myself using MSYS2 (64 bit) and COIN-OR's coinbrewscript. I subsequently used dependencies to verify that all dll dependencies are met (had to copy some dll's from "C:\msys64\mingw64\bin" as they were referenced as well).
My folder structure, in Eclipse, is the following:
src
| |clpsolver.model
| | |CLPDLLInterface.java
lib
| x64
| all dlls
In the CLPDLLInterface.java file, I use JNA as:
String libSubDir = "lib" + File.separator + "x64";
String dir = JNAPathHelper.addPluginRootToNativePath(CLPDLLInterface.class, libSubDir);
if (dir == null) {
System.loadLibrary("libClp-0.dll");
}
Native.register("libClp-0.dll");
}
libClp-0.dll depends on other dll's, and so on. I tried to load the dll that has no other dependencies than system32 dlls suing dependencies, though even that one won't load. What should I change to make this work?
Microsoft c++ redistributable is installed, and all dlls are executable, see this stackoverflow question