Sikuli X: Want to use Jython 2.5.2 with sikuli-script.jar

Asked by RaiMan on 2011-01-13

*** this is a how to

current release: Jython 2.5.2 (final release available since March 3, 2011)
Download link:

Be aware, that some things might not behave as expected:
Sikuli is tested and runs with Jython 2.5.1

If you want to use it, you have to make sure, that in sys.path the pointer to Jython/Lib comes before the entry sikuli-script.jar/Lib (which is needed to find the Python layer of Sikuli using: from sikuli.Sikuli import *).

You should copy sikuli-script.jar to a place, so that the resulting absolute path does not contain any blanks and use this copy in the further steps (bug 702155)

There might be many ways to do the following (depending on your environment and goals), but this at least works:

--- e.g. you have Jython in c:\Jython2.5.2 and copied sikuli-script.jar to this directory

--- set the environment variable CLASSPATH as the path to sikuli-script.jar

--- set the environment variable JYTHONPATH
set JYTHONPATH=c:\Jython2.5.2\Lib;c:\Jython2.5.2\sikuli-script.jar\Lib

--- use the jython command file (Windows: jython.bat, Mac/Linux: jython) in Jython/bin to run a Sikuli script
e.g. you have a script at path-to/myscript.sikuli, you have to say:
jython.bat path-to/myscript.sikuli/

--- comment on NetBeans/Eclipse:
If you use the Python plugins together with Jython 2.5.2 just check the generated sys.path in these environments at runtime of your script. It should be already in the correct sequence.

Question information

English Edit question
SikuliX Edit question
No assignee Edit question
Last query:
Last reply:
RaiMan (raimund-hocke) said : #1

*** this is a how to

surfdork (surfdork) said : #2

I dont understand how to configure Eclipse to use Sikuli from the instructions above.

What I need for Eclipse is enumerated steps. Eclipse is very tricky to configure, even for a seasoned developer.

I found these steps, unfortunatley I have no success following them

- installed Eclipse Helios Classic- installed the Plugin PyDev- installed Jython 2.5.1- made Jython the Interpreter in PyDev- in PyDev preferences -> PythonPath -> Ext.Libraries- a reference to sikuli-script.jar in the Sikuli program folder- a reference to the folder Lib/sikuli in the sikuli-script.jar (had to un-jar and copy the folder elsewhere)- in the script as first line:from Sikuli import *

So the question remains, is it even possible to use Eclipse with Sikuli and if so what are the working steps?

My options are to uninstall Win7x64 and replace with Win7x32 so I can continue to use Net Beans, which is a terrible IDE however it is usable.
Use another IDE. What other IDE supports using Sikuli in a x64 enviornment?

Traceback (most recent call last):
  File "C:\Users\mike\workspace\vcd_smoketest\src\", line 1, in <module>
    from sikuli.Sikuli import *
ImportError: No module named sikuli

RaiMan (raimund-hocke) said : #3

the above instructions are not intended to explain, how Eclipse has to be configured.

It is for people who want to use Jython 2.5.2 for whatever reasons (as the title says).

coldtest (tesger) said : #4

hi,RaiMan ,I did not success, I download jython 2.5.2 and my sys.path is :
['D:\\script\\jy', 'D:\\jython2.5.2\\Lib', 'D:\\jython2.5.2\\sikuli-script.jar',
 '__classpath__', '__pyclasspath__/', 'D:\\jython2.5.2\\Lib\\site-packages']

I also set the jythonpath environment :
D:\script\jy>set jythonpath

my classpath environment is :
D:\script\jy>set classpath
CLASSPATH=.;D:\jython2.5.2\sikuli-script.jar;D:\Program Files\Sikuli\sikuli-script.jar

my system path environment is :
D:\script\jy>set path
Path=D:\jython2.5.2\bin;d:\Ruby192\bin;D:\Python26\Scripts;D:\Python26\;d:\ruby\bin;C:\Program Files\PC Connectivity Solution\;C:\Program Files\ThinkPad\Utilities;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Intel\Wireless\Bin\;C:\Program Files\ThinkPad\ConnectUtilities;D:\Program Files\StormII\Codec\QTSystem\;C:\ProgramFiles\Microsoft SQL Server\80\Tools\Binn\;D:\jython2.5.2\bin;d:\jruby-1.6.1\bin;%APPDATA%\Python\Scripts;C:\Program Files\IDM Computer Solutions\UltraEdit\;E:\xampp\mysql\bin;D:\jdk1.6\bin;D:\Program Files\Sikuli\libs;C:\Program Files\Java\jre6\\bin

my jython code is :
import sys
from sikuli.Sikuli import *

print sys.path

when I run the scipt, I meet the error:

Traceback (most recent call last):
  File "", line 2, in <module>
    from sikuli.Sikuli import *
ImportError: No module named sikuli

expect for your help ,thanks

coldtest (tesger) said : #5

I solved the problem ,but I don't know wether it is a good way
I unzip the sikuli-script.jar to C:\sikuli-script and modify the script as :

import sys
print sys.path

from sikuli.Sikuli import *


It is excuted successly :
['D:\\script\\jy', 'D:\\jython2.5.2\\Lib', 'D:\\jython2.5.2\\sikuli-script.jar', '__classpath__', '__pyclasspath__/',
 'D:\\jython2.5.2\\Lib\\site-packages', 'C:\\sikuli-script\\Lib']
[info] Sikuli vision engine loaded.
[info] Windows utilities loaded.
[info] VDictProxy loaded.

RaiMan (raimund-hocke) said : #6

@ coldtest:
Yes this is a solution, but not necessary to do so.

First sorry, for the mistake in the post (I corrected it):

So you have the the correct sys.path as needed from beginning.
There is no need, to unzip sikuli-script.jar, since Jython accepts folder specifications inside of jar-files.

It is even possible to not copy sikuli-script.jar at all and use it at it's installation place (D:\Program Files\Sikuli\sikuli-script.jar in your case). The recommendation to copy it to another place was only, because it is not clear, whether the Jython problem with filenames containing blanks is fixed in 2.5.2. so you might give it a try.

One more thing:
is sufficient - you do not need it twice.

coldtest (tesger) said : #7

wonderful, thanks to RaiMan so much ,you are so warm-hearted , I run my script succesly as what you told

Anirban (ani-chat82) said : #8

I got an Sikuli built on Win 7 64 bit platform. But while running some script from Eclipse, the problem I am seeing is, the JNI loader of Sikuli is not able to load the files Win32Util.dll and VisionProxy.dll. Hence it is showing the error " Access denied for Win32Util.dll" and throwing FileNotFoundException.

Did anyone of you come across this problem and find a workaround for this?....The most surprising part is the if I want to open Sikuli IDE in Win 7 64 bit platform, it is opening fine and also loading the vision engine when I am giving command to perform a click somewhere. But I need to use sikuli script written in java from eclipse. So just thought of asking this question before giving up the hope.

Anirban (ani-chat82) said : #9

With respect to my previous post, please find below the exception that is happening:

Exception in thread "main" java.lang.UnsatisfiedLinkError: org.sikuli.script.natives.VisionProxyJNI.new_FindInput__SWIG_0()J

Hi RaiMan

Could you please share the link fron where I could download Jython 2.5.2


I tried the steps mentioned as above and i get following error message. Can anybody know what should i do to correct this.

[info] Windows utilities loaded.
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\tjannan\AppData\Local\Temp\tmplib\VisionProxy.dll: Can't find dependent libraries
 at java.lang.ClassLoader$NativeLibrary.load(Native Method)
 at java.lang.ClassLoader.loadLibrary0(Unknown Source)
 at java.lang.ClassLoader.loadLibrary(Unknown Source)
 at java.lang.Runtime.load0(Unknown Source)
 at java.lang.System.load(Unknown Source)
 at com.wapmx.nativeutils.jniloader.NativeLoader.loadLibrary(
 at org.sikuli.script.Finder.<clinit>(
 at org.sikuli.script.Region.doFind(
 at org.sikuli.script.Region$
 at org.sikuli.script.Region$Repeatable.repeat(
 at org.sikuli.script.Region.wait(
 at org.sikuli.script.Region.find(
 at org.sikuli.script.Region.getLocationFromPSRML(
 at org.sikuli.test_script.test01.main(

RaiMan (raimund-hocke) said : #12

@ thuwan

additionally you need the standard Sikuli installation and its path settings:

--- Sikuli installed in e.g.
c:\Program Files\Sikuli X

--- and system path added


Thanks for the Help. Is there any Guidance Document that we can use to Code Sikuli advanced scripts using Eclipse. It would be great if you can share some of examples in the official site..


RaiMan (raimund-hocke) said : #14

@ thuwan

There is no special document about using Sikuli with Jython directly or from inside Eclipse PyDev plugin.
All Sikuli script examples apply.

It is just Python programming with the special capabilities of using any Java classes directly.

The only additional aspects:
--- class-path and python-path settings according to the Sikuli docs
--- from sikuli import * needed even in the main script
--- you need an image concept for the captured images ( and might use the Sikuli IDE in parallel, to control the images ). The image support of import does not apply in this case, you have to use the image path feature.

Laanaya doha (dlaanaya) said : #15

Hello i'm new in sikuli and all the configuration.So i tried to do the configuration explained before but i'm stuck in the configuration of the classpath and the jythonpath, i don't know how to do so .
thank you for you're help