← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #622066]: cannot make selenium and sikuli executable file

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
ok, I already thought, that you might have this problem:
This only works in the project context, as long as you are working in the file system, where everything is folders.

But after having made this fat jar, the images are inside the jar at runtime, and cannot be accessed by simply using a folder path.
A jar is a zip file principally, and content you want to access as normal files during runtime, have either be exported from the jar (which SikuliX itself does with various things or must be "input" from the jar with special java features.

On possibility is to use the image path feature, to let SikuliX find the images at runtime inside the jar:
http://sikulix-2014.readthedocs.io/en/latest/scripting.html#image-search-path-where-sikulix-looks-for-image-files

read carefully, to understand the mechanics.

as far as I understand your setup, then you could use
Auto.Autotest/Images as the class reference for the jar situation and Images as alternate path for the project situation.
hence:
ImagePath.add("Auto.Autotest/Images", "Images")

... and your image references could be reduced to
    Pattern image1=new Pattern("1.png");
    Pattern image2=new Pattern("2.PNG");
    Pattern image3=new Pattern("3.PNG");

since they should now be found on the Imagepath

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