JUnit报错:java.lang.ClassNotFoundException: com.mogodb.test.test

  最近在使用JUnit做单元测试时,发现新写好的测试类运行总是出错,报找不到类异常。

JUnit报错:java.lang.ClassNotFoundException: com.mogodb.test.test
Class not found com.mogodb.test.test
java.lang.ClassNotFoundException: com.mogodb.test.test
 at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:693)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:429)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
JUnit报错:java.lang.ClassNotFoundException: com.mogodb.test.test

  查找对应的classes文件夹确实乜有发现响应的class文件生成。

  查看项目确实选择了自动编译!

  上网查找资料,发现了如下的解决办法:

  只要把Java--------compiler-------building-------Buil path problems ------- incomplete build path 和 Circular dependencies改成warning就可以了。

JUnit报错:java.lang.ClassNotFoundException: com.mogodb.test.test

JUnit报错:java.lang.ClassNotFoundException: com.mogodb.test.test

本文转自博客园xingoo的博客,原文链接:JUnit报错:java.lang.ClassNotFoundException: com.mogodb.test.test,如需转载请自行联系原博主。
上一篇:SharePoint 2013 删除母版页报错“This file may not be moved, deleted, renamed, or otherwise edited”


下一篇:MySQL基础5