JUNIT Test class in Eclipse - java.lang.ClassNotFoundException
Solution 1:
ConfigurationManagerTest
is not being found on your classpath. Ensure that the ConfigurationManagerTest.class
file is available on your classpath.
It might not exist if it wasn't successfully compiled or if it's being created in a directory that you haven't told the Eclipse project should be on the classpath.
Assuming that you've put your test classes in a separate folder, make sure that it shows up in the "Package Explorer" view (rather than the "Navigator" view).
Under the project properties, "Java Build Path" and the "Source" tab, you can also see if the source folder is included for building as well as where the .class files are generated.
Solution 2:
There is one more possibility. I had the same problem just now and no one of the solutions here helped. Except removing and recreating of the project - I didn't want to try it. What did help, was to clean the project two times immediately one after another! Clean + build could be repeated any number of times - it won't help. Only clean+clean and after that build goes OK. (Eclipse 3.6). Of course, you should disable autobuild for that.
Edit: This post has got its last plus on 15.11.2017. So, the problem (and the solution) remains actual.
Solution 3:
Another possible problem is a missing builder (it will prevent from your .class file from being built).
Check that your .project file has the following lines
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>