Cannot find class in classpath解决方法

1)Build Path出问题了

build path出问题了 ,java工程名前会有一个红色的感叹号,重新build一下

工程名上右键——》Build Path ——》Configure Build Path ...——》Libraries

2)依赖包版本版不兼容

换个testng版本就好了

 

————————————————————————————————————————————————————

备注:testng依赖下载地址——https://mvnrepository.com/artifact/org.testng/testng

原文地址:https://www.cnblogs.com/changpuyi/p/10479967.html