← Back to team overview

sikuli-driver team mailing list archive

[Question #280291]: Java Sikuli program not running from command line

 

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

I have created Java Sikuli project in Eclipse and everything works fine when i run the program from eclipse. Now i have to run same program on server using command line. Hence i have generated runnable jar which invokes main() and display first System.out.println message. after that when the Sikuli command starts it throws below error.

C:\Workspace>java -cp "C:\sikulix\sikulix.jar;C:\sikulix\sikulixapi.jar;C:\sikulix\sikuli-script.jar;C:\Workspace\DemoSikulix\DemoSikulix\lib\*;"
-jar DemoSikuli.jar

TestJavaSikuli program started...

Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.ExceptionInInitializerError
        at com.newt.DemoSikulix.TestJavaSikuli.main(TestJavaSikuli.java:13)
        ... 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


I have installed Sikluix with option 2 for java and have all jars in project/lib folder as wells in C:\sikulix folder

I have given classpath:  .;C:\Program Files (x86)\Java\jdk1.8.0_51\lib;C:\Program Files (x86)\Java\jre1.8.0_51\bin;C:\sikulix\sikulix.jar;C:\sikulix\sikulixapi.jar;C:\sikulix\sikuli-script.jar;C:\Sikuli-IDE\libs;

My Sample Java Sikuli code:
-------------------------------------------- 
import org.sikuli.script.*;

public class TestJavaSikuli {

        public static void main(String[] args) {

        	System.out.println("TestJavaSikuli program started...");
       		
                Screen s = new Screen();
               //ImagePath.add("ImageContainer/images.sikuli");
                try{                		
                        s.click("images/contactus.png");
                        s.wait(3.00);
                        s.click("images/home.png");
                }
                catch(FindFailed e){
                        e.printStackTrace();
                }
        }

}




-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.