← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #177873]: Sikuli Script integration with Java in Eclipse

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
--- System Path
- no need to put sikuli-script.jar in the system class path, as long as you are running your java code from inside eclipse

you say: in the path of system variable

hope it is in system preferences the pane Systemproperties -> extended
(or so) -> Environment Variables

There you should use the User Variables PATH entry and it should look
like this:

any-stuff-that-is-not-Sikuli;C:\Program Files\Sikuli X\libs;C:\Program
Files\Java\jre6\bin

make sure, that in the entries "any-stuff-that-is-not-Sikuli;" (which
might not be there) there is no reference to older Sikuli stuff

(no need to touch the System Variables Path entry for that)

After editing this it might be a good idea to at least logout and login
again.

--- java -jar "C:\Program Files\Sikuli X\sikuli-script.jar"
no ned to do that, to run a .sikuli.
use Sikuli-IDE.bat -r imgs2.sikuli

This command is only of use in situations, where you do not have the
complete Sikuli installation or for test situations, where one doubts,
it has something to do with the IDE part.

--- java code
If we are still talking about Eclipse:
add sikuli-script.jar to the class path settings of your java project. 

The docs at 
http://sikuli.org/docx/faq/030-java-dev.html#how-to-use-sikuli-script-in-your-java-programs

should have told you, that with X-1.0 it is no longer: import
edu.mit.csail.uid.FindFailed;

but:
import org.sikuli.script.*

your image references are:
imgs2/start.png

but as far as I understand:
you captured your images in imgs2.sikuli (which is the folder, where the images reside).
So if you want to use the images in your java code:
imgs2.sikuli/start.png

Have a look at class ImageLocator. This contains the method
addImagePath(). When adding your image locations this way, you do not
have the need to specify a path with each image, just the filename.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.