I am trying to write Java code that uses autohotkey, specifically the autoitx4java implementation. I have the imports
import java.text.SimpleDateFormat;
import java.util.Date;
import autoitx4java.AutoItX;
As well as have added Jacob.jar, AutoItX4Java.jar and sqljdbc4.jar in the build path (sql jdbc is for other parts of the code). It doesn't compile because of an unsatisfied link error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jacob-1.18-x86 in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at com.jacob.com.LibraryLoader.loadJacobLibrary(LibraryLoader.java:184)
at com.jacob.com.JacobObject.<clinit>(JacobObject.java:110)
at autoitx4java.AutoItX.<init>(AutoItX.java:181)
at MainTest.login(MainTest.java:126)
at MainTest.setadmin(MainTest.java:181)
at MainTest.runbasic(MainTest.java:21)
at MainTest.main(MainTest.java:15)
I have the jacob-1.18-x86.dll in the system32 folder (windows 8.1 is the OS) as well as jacob-1.18-x64.dll and jacob-1.18-M3-x64.dll, just in case it wanted to use the 64 bit dll. I tried adding C:/Windows/System32 to the jacob.jar "Native library location" (using eclipse) from some website, but that didn't work. Some other site suggested putting the dll in the C:\Program Files\Java\jre7\bin folder, so I did that, but it still throws the error. This code used to work on a different machine, but now it won't compile because of the unsatisfied link. I can't figure out where to put the jacob-1.18-x86 to get it to find it.
Well, copied it into the "C:\Program Files (x86)\Java\jre1.8.0_65\bin" folder and it worked. Apparently it only looks there for the jacob dll's.
来源:https://stackoverflow.com/questions/33919919/jacob-jar-cannot-find-jacob-1-18-x86-dll