简体   繁体   中英

Error while running selenium WebDriver jar on Linux (Working fine on Windows)

I am running a .jar file of selenium Webdriver java code on Linux server but getting below error:

A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriver

ALL the dependency .jar are added in final .jar file and I am using command : java -jar fileName.jar

It looks like its a clear case of missing selenium libraries in your uber jar.

The best way to check if your jar fileName.jar contains the WebDriver classes is to run something like this :

Here's an example

jar tvf selenium-server-standalone-3.5.0.jar | grep org/openqa/selenium/WebDriver.class
1305 Fri Feb 01 00:00:00 IST 1985 org/openqa/selenium/WebDriver.class

Depending on your uber jar building mechanism, you would need to ensure that you add up the webdriver jars into your uber jar.

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