简体   繁体   English

Sikuli出现ImagePath故障(JAVA)

[英]Sikuli Trouble with ImagePath (JAVA)

I'm having a problem exporting a maven project in eclipse that uses the sikuli library. 我在使用sikuli库的eclipse中导出Maven项目时遇到问题。 In eclipse everything works fine and the application runs great. 在eclipse中,一切正常,应用程序运行良好。 I also have to note that I never used maven before (so I might do something "stupid"). 我还必须指出,我以前从未使用过Maven(因此我可能会做“愚蠢”的事情)。 The problem is that once exported, the application can't find the images I stored within the runnable jar. 问题在于,一旦导出,应用程序将找不到我存储在可运行jar中的图像。 This is the error I got: https://drive.google.com/file/d/0BymG7-nABOfnTmR0NzdTXzlSU2M/view 这是我收到的错误: https : //drive.google.com/file/d/0BymG7-nABOfnTmR0NzdTXzlSU2M/view

The images are stored in resources inside the sikuli map. 图像存储在sikuli映射内的资源中。 You can see the code and project hierarchy over here: https://drive.google.com/file/d/0BymG7-nABOfnazJqYTg5ekJzSFE/view?usp=sharing 您可以在此处查看代码和项目层次结构: https : //drive.google.com/file/d/0BymG7-nABOfnazJqYTg5ekJzSFE/view?usp=sharing

The main method is written inside Launcher.java. 主要方法是在Launcher.java中编写的。 I think the problem in my code is located near the ImagePath.add line. 我认为代码中的问题位于ImagePath.add行附近。 Can anyone help me, so the application runs outside eclipse? 谁能帮我,所以应用程序在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 这些网站上有一些有关ImagePath的信息: 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 提前致谢

try this, 尝试这个,

Import the following 导入以下

 import org.sikuli.basics.ImageLocator;

use this function inside your program 在程序中使用此功能

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM