Published on

[Solved]: Eclipse JUnit Error: Class not found java. java.lang.ClassNotFoundException...


Running into the following error when trying to run some Junit tests via Run As -> JUnit Test on Eclipse Enterprise Edition.

Class not found com.codinginformer.test.SeleniumTest
java.lang.ClassNotFoundException: com.codinginformer.test.SeleniumTest
	at java.lang.ClassLoader.loadClass(
	at sun.misc.Launcher$AppClassLoader.loadClass(
	at java.lang.ClassLoader.loadClass(
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(


This error could be due to not activating seperate output folders for each folder in your build path.

Try this potential solution and see if it works:

  1. Right click on your project -> Select Properties -> Select Java Build Path -> Select the Sources tab
  2. If you don't see the Output folder option in the dropdown list below your build folder make sure to enable the checkbox Allow output folder for source folders. Then double click Output folder
  3. In the following modal select Specific output folder. Then, enter the following output path for the enabled field: target/classes. Note: The specific output path name doesn't matter as much as you defining an explicit output path instead of using the default output path
  4. Select Ok -> Apply and Close. Finally Run the JUnit tests via Run As -> JUnit Test


Thanks for reading this blog post!

If you have any questions or concerns please feel free to post a comment in this post and I will get back to you when I find the time.

If you found this article helpful please share it and make sure to follow me on Twitter and GitHub, connect with me on LinkedIn and subscribe to my YouTube channel.