发生 JNI 错误.请检查您的安装 [英] JNI error has occurred. Please check your installation
问题描述
我正在尝试使用 TestNG 运行一个非常简单的测试,但我收到了此错误消息.我尝试阅读以前的答案,但它对我不起作用.如果有人可以帮助我,我会很高兴,因为我只是 TestNG 的初学者.这是错误信息:
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
推荐答案
是的,有一个 testNG
在 Eclipse 上运行的问题.从这篇文章开始,您可以尝试通过添加 jcommander jar 文件 在您的构建路径中,然后从 Eclipse 运行您的 testNG
套件.
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 jcommander jar file in your build path and then run your testNG
suite from eclipse.
如果你想使用命令提示符或终端运行,这里是如何在 MAC 上执行 -
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
同样地替换你的 windows 路径,你的测试套件将使用命令提示符运行,没有任何错误.
Similarly replace your path for windows too and your test suite will run as without any errors using command prompt.
这篇关于发生 JNI 错误.请检查您的安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!