← Back to team overview

sikuli-driver team mailing list archive

[Question #166990]: running Sikuli Script from crontab gives Error: Can't connect to X11 window server using ':0

 

New question #166990 on Sikuli:
https://answers.launchpad.net/sikuli/+question/166990

Hi there,

I have built a Sikuli Script that runs successfully from command line in linux:  OS  Debian 6.0.2  GNOME Desktop Version 2.30.2

This is how I would run the script directly (using full paths)  in my user session:
/usr/share/my-path/Sikuli-IDE/sikuli-ide.sh my-path/mydemo.sikuli.skl

Next I want to be able to run this script daily at a specified time using crontab (my username).

This  https://help.ubuntu.com/community/CronHowto says that it is possible to run gui applications via cronjobs. This can be done by telling cron which display to use. 

So I have followed the suggestion when specifying the job in the crontab (my username)

15 15 * * * env DISPLAY=:0 /usr/share/my-path/Sikuli-IDE/sikuli-ide.sh my-path/mydemo.sikuli.skl

However, this error occurs when the cronjob runs  (the error is emailed from the cron-daemon):

--------------------------------------
No protocol specified
Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable.
        at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
        at sun.awt.X11GraphicsEnvironment.access$100(X11GraphicsEnvironment.java:62)
        at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:166)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:142)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:186)
        at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:82)
        at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:112)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:186)
        at java.awt.Toolkit$2.run(Toolkit.java:849)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:841)
        at javax.swing.ImageIcon.<init>(ImageIcon.java:136)
        at javax.swing.ImageIcon.<init>(ImageIcon.java:155)
        at org.sikuli.ide.SikuliIDE.getIconResource(SikuliIDE.java:106)
        at org.sikuli.ide.SikuliIDE.<clinit>(SikuliIDE.java:85)
Could not find the main class: org.sikuli.ide.SikuliIDE. Program will exit.
-----------------------------------------

Do you have any other suggestions?  Surely other folks must successfully execute their Sikuli Scripts via linux cronjobs.

Thanks.
Carla




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