在 TESTNG 的类路径问题中找不到类 [英] Cannot find class in classpath issue with TESTNG

查看:37
本文介绍了在 TESTNG 的类路径问题中找不到类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在将 testng 与我们的应用程序集成,我为 ant build 创建了 testng.xml 和 testngbuild.xml.在运行 ant build 时,它抛出了 Not find class in classpath:.其实我尝试了很多方法.但我还是无望.即使我尝试将 .class 文件手动复制到应用程序的 testng 目录中.如果你可以这样做,它会抛出另一个异常,因为无法加载 .class 文件

WE are integrating testng with our application, I created testng.xml and testngbuild.xml for ant build . While running ant build it is throwing Cannot find class in classpath:. Actually I tried many ways. But I am still hopeless. Even I tried copying manually .class file to my testng directory of the application. If you can do like this, It is throwing another exception as could not load .class file

推荐答案

就连我也多次遇到同样的问题.您可以尝试以下对我有用的解决方案.

Even I faced the same problem many a times. You can try below solutions which worked for me.

  1. 点击特定项目->项目->清理->刷新

  1. Click on specific project ->Project->Clean-> refresh

因为在IDE中还有其他打开的项目.仅保留您正在处理的项目打开和关闭其他不相关的项目.右键单击-> 关闭项目.

Because of other open projects in IDE. Keep only the project you are working on open and close other non related projects. Right click-> Close Project.

有时你不会相信罪魁祸首是 Excel 工作表(不知道它是如何相关的),当你打开它时,单独的实例可能已经用它创建了等等.关闭它并删除任何正在运行的进程用 excel 表将解决.

And you won't believe sometimes the culprit is Excel sheet(Don't know how it is related) when you have it open and sepearate instance might have created with that etc. Close it and kll any process running with excel sheet will resolve.

这篇关于在 TESTNG 的类路径问题中找不到类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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