unable to run jar file with sikuli from command prompt

Asked by shadab

Able to run project from eclipse..but when trying to run from cmd prompt..getting below error:

H:\Users\shadab1>java -cp H:\Users\shadab1\Desktop\Eclipse\Selenium\sikulix\siku
lixapi.jar -jar H:\Users\shadab1\Desktop\launch.jar
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa
der.java:58)
Caused by: java.lang.ExceptionInInitializerError
        at sikuli_exp.exp1.main(exp1.java:12)
        ... 5 more
Caused by: java.lang.NullPointerException
        at org.sikuli.script.RunTime.init(RunTime.java:635)
        at org.sikuli.script.RunTime.get(RunTime.java:291)
        at org.sikuli.script.RunTime.get(RunTime.java:126)
        at org.sikuli.script.RunTime.get(RunTime.java:316)
        at org.sikuli.script.Region.<clinit>(Region.java:31)
        ... 6 more

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
shadab
Solved:
Last query:
Last reply:
Revision history for this message
Chathura (chathuragune) said :
#1

I got to work with runsikulix.cmd as:

runsikulix.cmd -r filename.sikuli -- option1 -- option2 > debug.txt

check the debug.txt file for errors.

Revision history for this message
shadab (shadab1rizvi) said :
#2

So after a lot of experimentation...this is how i solved my problem....

1. I ensured that i am using the latest sikuli jar file.
2. Instead of packaging my external jar files inside the main jar...i made eclipse create a lib folder which had all the supporting jars ...and ensured that the folder is in the same location as the runnable jar file.

3. After that i did not have to pass classpath to jars while running them...