Class not found解决办法

Class not found com.spring.demo java.lang.ClassNotFoundException

Description

Junit做测试,遇到两个问题,最开始的时候就是只出现之前代码的结果,解决之后后来就是出现找不到类的情况,如下

Class not found com.spring.demo
java.lang.ClassNotFoundException: 
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)

Solution

逐一试了网上的各种方法,不涉及数据库连接的问题(不涉及mysql-connector),修改build path problems。具体步骤如下:

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

Class not found解决办法_第1张图片
Class not found解决办法_第2张图片

Appendix

1.转自:
作者:xingoo.

你可能感兴趣的:(Tools,junit,eclipse)