学习testNG之报错-A JNI error has occurred
来源:互联网 发布:网络dns错误怎么办 编辑:程序博客网 时间:2024/05/29 08:57
安装完testNG后,创建第一个程序hello,导入testng的jar包,新建hello类,如下:
> package com.shanghai.test;> > public class Hello {> > public String mail() { return "32423@qq.com"; } }
新建testng类TestHello测试hello类,代码如下
package com.shanghai.test;import org.testng.Assert;import org.testng.annotations.Test;public class TestHello { @Test public void f() { Hello he = new Hello(); String aa = he.mail(); Assert.assertNotNull(aa); Assert.assertEquals(aa, "32423@qq.com"); }}
执行testng程序,报如下错误:
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
原因:没有添加jcommander jar包
maven下载jcommander-1.48.jar包Builder path后执行成功
阅读全文
0 0
- 学习testNG之报错-A JNI error has occurred
- TestNG运行报错:Error: A JNI error has occurred
- 运行JFinal时jdk报错:A JNI error has occurred,please check your installation and try again
- Android之JNI NDK错误 c/c++ indexer has encountered a problem, An internal error occurred during xx
- Error: A JNI error has occurred, please check your installation and try again
- eclipse中执行程序时报错'A JNI error has occurred,please check your installation and try again'
- Eclipse启动报错。错误代码: error:could not create the java machine.Error: A fatal exception has occurred.
- IDEA 运行测试报错 Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred.
- eclipse启动报错:Error:Could not create the Java Virtual Machine Error:A fatal exception has occurred
- eclipse启动报错:Error:Could not create the Java Virtual Machine Error:A fatal exception has occurred
- kettle启动报错‘A Java Exception has occurred.’
- MyEclipse部署/启动服务报错 'update progress' has encountered aproblem.An tinernal error has occurred
- MyEclipse An error has occurred. See error log for more details.报错的解决办法
- MyEclipse An error has occurred. See error log for more details.报错的解决办法
- MyEclipse An error has occurred. See error log for more details.报错的解决办法
- 使用IntelliJ IDEA导入storm-starter并测试WordCountTopology运行出现 A JNI error has occurred的原因和解决
- eclipse突然打开报错,提示An error has occurred.See the logfile解决
- Vbox 安装 windows Server 2008 R2 报错 Info: An unexpected error has occurred 解决方法
- python打赢乘法表
- Guessing the Dice Roll HDU
- ubuntu下mysql的简单操作
- PV操作解决吃水果问题(Java实现)
- 求数组中元素第一次出现的索引值
- 学习testNG之报错-A JNI error has occurred
- 模板方法模式
- 有没有大神能够逐行解释一下代码?Delphi
- File类的概述和常用功能:File类的创建和删除功能:File类的判断功能:File类的获取功能和修改名字功能File的重要获取功能
- 单片机中常见英文缩写(51为例)
- 单链表逆置实现(C++)
- 通过人脸识别查找相似图片
- 梦想起飞的地方
- 石乐志的wwq