Diff in running Sikuli/Jython script from eclipse and command line

Asked by Eugene

Hi,

I am using eclipse and Jython to run my Sikuli scripts, but looking for the solution to run the same script from the command line. I googled that topic and found some explanations here http://doc.sikuli.org/faq/010-command-line.html.

However, when I was trying to create .bat file I got the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: Files\Sikuli
Caused by: java.lang.ClassNotFoundException: Files\Sikuli
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: Files\Sikuli. Program will exit.

Executing script from eclipse is fine. I understand that eclipse behind the scene links all of the required libraries. So my question is what do I need to set in order to execute my script from the command line? Here is my path

PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32
\WindowsPowerShell\v1.0\;C:\Program Files\ThinkPad\Bluetooth Software\;C:\Progra
m Files\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Common Files\Lenov
o;C:\Program Files\Lenovo\Access Connections\;C:\Python27;C:\Python27\Scripts;C:
\Program Files\Sikuli X\libs;C:\Program Files\Java\jre6\\bin

Any advice will be greatly appreciable.

Thanks,
Eugene

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
EdEd (sikuli-3-connelm) said :
#1

was ";C:\Program Files\Java\jre6\\bin" at the very end, a typo? You have an extra backslash character in the 4th-to-last character. Is that causing the problem in your system environment variable PATH?

Revision history for this message
RaiMan (raimund-hocke) said :
#2

Show the commands you are using on the command line.

Might be that faq 2020 helps.

Revision history for this message
Eugene (geen66) said :
#3

@RaiMan

Here is what I used:

set SCRIPT="C:\Users\Eugene\git\desktop.sikuli.automation\src\tests\test1.py"
java -cp C:\Program Files\Sikuli X\sikuli-script.jar org.python.util.jython %SCRIPT%

@EdEd

yes, this was a typo and I corrected this, thank you. Unfortunately it has no effect on my problem

Revision history for this message
Best RaiMan (raimund-hocke) said :
#4

must be

java -cp "C:\Program Files\Sikuli X\sikuli-script.jar" org.python.util.jython %SCRIPT%

Revision history for this message
Eugene (geen66) said :
#5

@RaiMan

Thank you so much for your help - it works for me now!

Eugene

Revision history for this message
Eugene (geen66) said :
#6

Thanks RaiMan, that solved my question.