发生JNI错误。请检查您的安装 [英] JNI error has occurred. Please check your installation

查看:1975
本文介绍了发生JNI错误。请检查您的安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用TestNG运行一个非常简单的测试,但是我收到这个错误消息。我尝试阅读以前的答案,但它并不适用于我。如果有人可以帮助我,我会很高兴,因为我刚刚是TestNG的初学者。这是错误消息:

 线程main中的异常java.lang.NoClassDefFoundError:com / beust / jcommander / ParameterException 
在java.lang.Class.getDeclaredMethods0(本机方法)
在java.lang.Class.privateGetDeclaredMethods(未知源)
在java.lang.Class.privateGetMethodRecursive(未知来源)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(未知源)
引起的:java.lang.ClassNotFoundException:com.beust.jcommander.ParameterException
在java.net.URLClassLoader.findClass(未知来源)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher $ AppClassLoader.loadClass(Unknown Source)
在java.lang.ClassLoader.loadClass(未知来源)
... 7更多


解决方案

是的,有一个在$ eclipse上运行 testNG 的问题。在这篇文章之后,您可以尝试解决方法来修复错误,方法是添加 jcommader jar文件在您的构建路径中,然后从eclipse运行您的 testNG 套件。



如果要使用命令提示符或终端运行,请在MAC上执行以下操作 -

  java -cpPATH / TO / TESTNG.jar:PATH / TO / jcommander-1.7.jarorg.testng.TestNG testng.xml 
/ pre>

同样地,替换Windows的路径,您的测试套件将使用命令提示符运行无任何错误。


I'm trying to run a very simple test using TestNG, but I'm getting this error message. I tried reading the previous answers, but it is not working to me. I would be happy if someone could help me out, since I'm just a beginner in TestNG. This is the error message :

Exception in thread "main" java.lang.NoClassDefFoundError: com/beust/jcommander/ParameterException
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
    at java.lang.Class.privateGetMethodRecursive(Unknown Source)
    at java.lang.Class.getMethod0(Unknown Source)
    at java.lang.Class.getMethod(Unknown Source)
    at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
    at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.beust.jcommander.ParameterException
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 7 more

解决方案

Yes there is an issue with testNG running on eclipse. As of this post you can try a workaround to fix your error by adding the jcommader jar file in your build path and then run your testNG suite from eclipse.

If you want to run using command prompt or terminal, here's how to do it on MAC -

java -cp "PATH/TO/TESTNG.jar:PATH/TO/jcommander-1.7.jar" org.testng.TestNG testng.xml

Similarly replace your path for windows too and your test suite will run as without any errors using command prompt.

这篇关于发生JNI错误。请检查您的安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆