0

I have a question regarding selenium with sikuli runnable jar. I created a code for testing a page and when I run it from eclipse it does everything perfectly, but when I export it as runnable jar and start the script with java -jar filename.jar it gives me the following error:

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(JarRsrcLoader.java:58)
Caused by: java.lang.ExceptionInInitializerError
        at LogOut.main(LogOut.java:16)
        ... 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 

So my question is basically how can jar give me those errors while eclips runs it with no problem. My goal is to create a jar that can be executed on another computer so I hope that you can help me figure this out. Thanks

Meister96Fels
  • 508
  • 1
  • 8
  • 26
mirx
  • 13
  • 3

1 Answers1

0

actually the test script you have created it don't have any issue if you created the jar file the project should contain at least one main method to run actually when you create an any jar file the project files should contain at least one main method hence it's showing the error

please visit the link for reference for better understanding

https://support.smartbear.com/alertsite/docs/monitors/web/selenium/create-runnable-jar-from-selenium-script-using-eclipse.html

akshay patil
  • 670
  • 7
  • 20
  • Hi, sorry for the late answer I was sick so I wasn't here for some time. However every one of my test cases is created as separate class and each one of them has a main method. Also i tried to create a project with only one class, and then export and run it, but I got the same error. – mirx Feb 12 '19 at 11:40