且构网

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

无法找到或加载主类org.junit.runner.JUnitCore

更新时间:2022-05-13 06:17:29

您似乎在Windows而不是LINUX/UNIX下运行. Windows上的路径分隔符是;,而不是:.此外,您还没有将jar文件放在类路径中.所以你想要的是:

You seem to be running under Windows, not LINUX/UNIX. The path separator on Windows is ;, not :. Additionally, you haven't put you jar file in the classpath. So what you want is:

java -cp aJar.jar;junit-4.10.jar org.junit.runner.JUnitCore TestOne

这当然假定两个jar都在当前目录中.您还应该始终避免将类放入默认包中.

This of course assumes that both jars are in the current directory. You should also always avoid putting classes in the default package.