[英]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: 我在Linux服务器上运行Selenium Webdriver Java代码的.jar文件,但出现以下错误:
A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriver
发生了JNI错误,请检查您的安装,然后重试。线程“主”中的异常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 所有的依赖项.jar都添加到了最终的.jar文件中,我正在使用命令: java -jar fileName.jar
It looks like its a clear case of missing selenium libraries in your uber jar. 看起来很明显,您的uber jar中缺少硒库。
The best way to check if your jar fileName.jar
contains the WebDriver
classes is to run something like this : 检查jar
fileName.jar
包含WebDriver
类的最好方法是运行以下命令:
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. 根据您的uber jar构建机制,您需要确保将webdriver jar添加到uber jar中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.