简体   繁体   中英

Selenium + sikuli runnable jar

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM