0

I have a 32 bit DLL that I want to access using JNA (I am running Windows 10 64 bit). If I use JDK 1.6 the call to LoadLibrary passes but if I use the 32 bit version of JDK 1.8 then it fails.

The error message given in JDK 1.8 is "java.lang.UnsatisfiedLinkError: Unable to load library 'mydll': The specified module could not be found"

public interface MYDLL extends Library {
  MYDLL INSTANCE = (MYDLL) Native.loadLibrary("mydll", MYDLL.class);
}
  • 2
    Have you tried java -Djava.library.path= "your dll path" – Novaterata Apr 21 '17 at 15:28
  • Possible duplicate of [Trying to use DLL from Java (JNA). Unable to load library exception](http://stackoverflow.com/questions/14286647/trying-to-use-dll-from-java-jna-unable-to-load-library-exception) – Daniel Widdis Apr 22 '17 at 02:13
  • Yes, I confirm that I have included the -D option in the run command line but this does not change anything – CharlesHill Apr 22 '17 at 08:21
  • @CharlesHill The JRE itself can either be 32-bit or 64-bit, but not both. Can you double check that your Java 8 JRE is 32-bit. It's very likely that your Java 6 JRE is 32-bit, but your Java 8 JRE is 64-bit. Even if you install both, then only one will be in the PATH. I just saw that you said it was 32-bit in your question, but I still think you need to double check. What is the output of `java -version`? – Novaterata Apr 25 '17 at 21:07
  • Also make sure any pre-reqs for the DLL like Visual C++ Redistributable etc. are installed. Did you test against Java 6 and 8 on the same machine? or were these on separate machines or VMs? – Novaterata Apr 25 '17 at 21:13
  • I have checked and ensured that I was using the 32bit JRE. Also I confirm that I was running Java 6 a nd 8 on the same computer. What I have subsequently found is that the problem is with a specific dll, not other 32bit DLLs. I checked the dll with DependencyWalker but cannot find any differences in the required dlls. What is strange is that VB6 loaded on the Windows 10 machine has no problem working with the file - I suspect that there is some dependency issue. – CharlesHill Apr 27 '17 at 07:05
  • I had same problem but i solved it i think u can solve this problem reinstall microsoft visual c++ package maybe u can check log event viewer in window – Mockyung Sung Mar 05 '21 at 08:56

0 Answers0