我已经创建了java application
使用sikuli-script(latest version 1.0.1)
.
我添加了sikuli-script.jar
到Referenced Libraries
(我使用这个答案配置Answer Link)
java code
文件夹结构-->
Java code
-->
package com.example.sikuli;
import org.sikuli.script.*;
import java.util.concurrent.TimeUnit;
public class TestSikuli {
public static void main(String[] args) {
Screen s = new Screen();
App app = new App("C:/Program Files/Mozilla Firefox/firefox.exe");//firefox path
try{
app.focus();
TimeUnit.SECONDS.sleep(2);
s.click("imgs/1391152193781.png", 0);//url bar image
s.type(null, "http://www.google.lk", 0);
s.click("imgs/1391152289812.png", 0);//click search image
}
catch(FindFailed e){
e.printStackTrace();
}
}
}
之后我设置了Run Configutrtion
如PATH
和SIKULI_HOME
接下来我运行代码,它工作正常。
然后我创建.exe
使用launch4j
并根据本网站说明 --> How to Create an Executable File from Eclipse
之后我运行 .exe
文件来自command prompt
然后出现以下错误。请帮助我。
Error
-->
[error] ResourceLoaderBasic: check: libs dir is empty, has wrong content or is outdated
[action] ResourceLoaderBasic: check: Please wait! Trying to extract libs to: C:\Documents and Settings\Dell\SikuliX\libs
[error] ResourceLoaderBasic: loadLib: Fatal Error 109: not found: C:\Documents and Settings\Dell\SikuliX\libs\VisionProxy.dll
[error] Terminating SikuliX after a fatal error(109)! Sorry, but it makes no sense to continue!
If you do not have any idea about the error cause or solution, run againwith a Debug level of 3. You might paste the output to the Q&A board.
最佳答案
--1。当使用 Sikuli 进行 Java 编程时,您应该始终使用 sikuli-java.jar(sikuli-ide.jar 包含许多此处不需要的内容)。
--2。运行 exe 时设置 JVM 选项 -Dsikuli.Debug=3 以获取有关所发生情况的更多详细信息。我想问题是,由于某种原因, native 库的导出在 launch4J exe 的上下文中不起作用(我尚未对此进行测试)。
--3。始终使用最新版本(在本例中为 1.1.1,仍然是每晚但预最终版本;-) http://sikulix.com
关于java - 如何使用 Sikuli-script + Java + Eclipse IDE 创建适用于任何平台的可执行 (.exe) 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21621000/