你好我使用autoitx4java.Below在我的Java程序中使用的AutoIt是我使用的代码:无法启动CMD或Java中使用
import java.io.File;
import autoitx4java.AutoItX;
import com.jacob.com.LibraryLoader;
public class MyTest {
public static void main(String[] args) throws InterruptedException{
// TODO Auto-generated method stub
String jacobDllVersionToUse;
if (jvmBitVersion().contains("32")){
jacobDllVersionToUse = "jacob-1.18-x86.dll";
}
else {
jacobDllVersionToUse = "jacob-1.18-x64.dll";
}
File file = new File("lib", jacobDllVersionToUse);
System.setProperty(LibraryLoader.JACOB_DLL_PATH, file.getAbsolutePath());
AutoItX x = new AutoItX();
// System.out.println(file.getAbsolutePath());
x.run("cmd.exe");
}
private static String jvmBitVersion() {
// TODO Auto-generated method stub
System.out.println(System.getProperty("sun.arch.data.model"));
return System.getProperty("sun.arch.data.model");
}
}
当我运行这个程序,什么都不会发生,并有也没有错误。这也发生,如果我替换cmd.exe notepad.exe。 但是,当我用calc.exe计算器启动替换cmd.exe。
我是新来的AutoIt和使用下面的链接设置的AutoIt与Java:
也许你应该检查的是操作系统体系结构,而不是JVM体系结构。毕竟,您可以在64位操作系统上运行32位JVM。强制你的代码使用64位DLL,如果这不起作用,那么强制32位DLL,如果这不起作用,然后尝试提供一个明确的路径cmd.exe,看看是否有所作为。 – DevilsHnd