Sikuli Trouble with ImagePath (JAVA)

大兔子大兔子 提交于 2019-12-25 16:30:24

问题


I'm having a problem exporting a maven project in eclipse that uses the sikuli library. In eclipse everything works fine and the application runs great. I also have to note that I never used maven before (so I might do something "stupid"). The problem is that once exported, the application can't find the images I stored within the runnable jar. This is the error I got: https://drive.google.com/file/d/0BymG7-nABOfnTmR0NzdTXzlSU2M/view

The images are stored in resources inside the sikuli map. You can see the code and project hierarchy over here: https://drive.google.com/file/d/0BymG7-nABOfnazJqYTg5ekJzSFE/view?usp=sharing

The main method is written inside Launcher.java. I think the problem in my code is located near the ImagePath.add line. Can anyone help me, so the application runs outside eclipse?

There is some information about ImagePath on these websites: http://sikulix-2014.readthedocs.org/en/latest/faq/030-java-dev.html http://sikulix-2014.readthedocs.org/en/latest/scripting.html#imagesearchpath

Thanks in advance


回答1:


try this,

Import the following

 import org.sikuli.basics.ImageLocator;

use this function inside your program

ImageLocator.setBundlePath("path to img directory");


来源:https://stackoverflow.com/questions/28187543/sikuli-trouble-with-imagepath-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!