← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #668479]: screen works in IDE run but not in .jar output

 

Question #668479 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/668479

    Status: Open => Answered

RaiMan proposed the following answer:
the problem is: 
new Pattern("pics/addToCart.png");

Running in the IDE:
the relative path can be converted to an absolute path in the project folder: the imagefile is found

Running the built jar:
the relative path is converted to absolute based on the current working directory: imagefile not found!
... since the imagefile now is inside the jar.

Solution:
use ImagePath feature relative to a classfile:
http://sikulix-2014.readthedocs.io/en/latest/scripting.html#image-search-path-where-sikulix-looks-for-image-files

BTW:
Starting with a new library an empty catch(){} does not make much sense, since it hides exceptions.
In this case the exception would have told you: FindFailed (imagefile not found)

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.