Getting a "ClassNotFoundException" exception when running sikuli-script from command line

Asked by Eugene S

I have viewed few questions which seemed to have a problem similar to mine but it looks like I have something different in my case.
When I start a sikuli-script from command line under Windows 7, I get the following error:

C:\Sikuli\Tests>C:\Sikuli\sikuli-script.cmd -r C:\Sikuli\Tests\ADRS.sikuli
-Xms64M -Xmx512M -Dfile.encoding=UTF-8
-r C:\Sikuli\Tests\ADRS.sikuli
+++ using as SIKULIX_HOME: C:\Sikuli\
+++ this Sikuli version is 32-Bit
java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11)
Java HotSpot(TM) Client VM (build 20.4-b02, mixed mode, sharing)
+++ trying to start Sikuli Script
Exception in thread "main" java.lang.NoClassDefFoundError: org/sikuli/script/Sik
uliScript
Caused by: java.lang.ClassNotFoundException: org.sikuli.script.SikuliScript
        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: org.sikuli.script.SikuliScript . Program will exit.

Any suggestion as to what can cause such behavior and how can it be fixed?

Thanks in advance!

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
Eugene S (shragovich) said :
#1

Just found out that it might be related to the Bug #1182870.
Am I right?

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

Might be.
Does it work with the given workaround?

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

Yes, I have tried to run the script as follows and it succeeded:

C:\Sikuli\Tests>C:\Sikuli\sikuli-script.cmd -j6 -r C:\Sikuli\Tests\eReferrals.sikuli

I have also discovered that swapping the arguments will not work. I'm not sure whether that's a way is supposed to work or a defect.
C:\Sikuli\Tests>C:\Sikuli\sikuli-script.cmd -r -j6 C:\Sikuli\Tests\eReferrals.sikuli

Cheers,
Eugene

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

That is by design ;-) because -j6 is a switch and -r a parameter, that needs a following filename (script to be run)

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

Thanks for your super quick replies! :)
I will then use the suggested workaround until the fix is being introduced in the next version.

Cheers,
Eugene

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

Thanks RaiMan, that solved my question.