出现错误无法找到或加载主类 org.testng.TestNG [英] Getting error Could not find or load main class org.testng.TestNG

查看:30
本文介绍了出现错误无法找到或加载主类 org.testng.TestNG的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从命令行运行 TestNG,但它给了我错误.谁能告诉我哪里出错了?

java -cp C:/TestNG 目录/testng-6.2.jar;C:project 目录srccomsuitessuiteshop org.testng.TestNG testng.xml

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

当我从 eclipse testng 插件 运行脚本时,我的脚本运行良好.

解决方案

  1. 将以下命令复制到文本文件中.

  2. 编辑位置.

  3. 另存为yourtext.bat

  4. 现在,双击创建的批处理文件.

<块引用>

cd C:Workspaceprojectname

java -cp C:Workspaceprojectnamelib*;C:Workspaceprojectnamein org.testng.TestNG testng.xml

I'm trying to run TestNG from command line, but it's giving me error. Can someone tell me where am I going wrong?

java -cp C:/TestNG directory/testng-6.2.jar;C:project directorysrccomsuitessuiteshop org.testng.TestNG testng.xml

Error: Could not find or load main class org.testng.TestNG

My scripts runs fine when I ran them from eclipse testng plugin.

解决方案

  1. Copy the below commands in a text file.

  2. Edit the location.

  3. Save it as yourtext.bat

  4. Now, double click on the batch file created.

cd C:Workspaceprojectname

java -cp C:Workspaceprojectnamelib*;C:Workspaceprojectnamein org.testng.TestNG testng.xml

这篇关于出现错误无法找到或加载主类 org.testng.TestNG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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