且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法找到或加载主类org.testng.TestNG

更新时间:2021-08-04 23:39:53

第一个命令:

java -jar myjar.jar -cp ./bin testng-qc-sanity-regression.xml

将尝试执行下META-INF / MANIFEST.MF的jar文件中定义你的主类,这是不是你想要的。

will try to execute your main class defined in the jar file under META-INF/MANIFEST.MF which is not what you want.

第二个命令

java -cp D:\Profiles\user.m2\repository\org\testng\testng\6.8.5\testng-6.8.5.jar; org.testng.TestNG testng-qc-sanity-regression.xml

没有定义在类路径中的当前目录也有路径一个错字。

is not defining the current directory on classpath and there is also a typo in the path.

尝试使用以下内容:

java -cp ".;D:\Profiles\user\.m2\repository\org\testng\testng\6.8.5\testng-6.8.5.jar" org.testng.TestNG testng-qc-sanity-regression.xml