I\'m trying to run my junit test (to verify that a properties file loads correctly) but
I get ClassNotFoundException
although the class is there and all requir
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.
I know this has been already answered a long time ago but the answer didnt fix it for me but, I just removed everything from the sources in the buildpath settings and re-added them
A variation on Guy's answer above, involving additional builders. Say you have an Ant builder configured:
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value><project>/.externalToolBuilders/myprojectantlaunch.launch</value>
</dictionary>
</arguments>
</buildCommand>
</buildSpec>
If the Ant build and Eclipse build have differing output locations, Eclipse may not be able to locate the test class on the classpath. In the case of an Ant builder, also check the configured targets for clean, auto, manual and after-clean builds, to ensure that the target which builds the unit tests is called.
This happened to me when I was dragging and dropping test classes to different packages. I just did the following
Bingo! I can now run the test!
If you have a maven project try to run:
mvn clean compile
and then in eclipse clean & build your project.
The above mentioned solutions didn't work for me.
I just restarted my IDE by closing it and reopening it.
And then error disappeared and its working fine now.