NoClassDefFoundError: org/hamcrest/SelfDescribing

I hit the following issue while trying to run a JUnit test in Eclipse:

initializationError
The Failure Trace displayed a message stating java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing

initializationError while running Junit Test

I made sure that I had JUnit 4 and org.hamcrest.core along with the Java library in my project but still faced this issue.

After analyzing quite a bit, I noticed that my JRE System Library also has JUnit files associated. I added the org.hamcrest.core_1xx.jar to my JRE path as shown below.

Adding Hamcrest to Java files

I ran the test again. This time the test run was successful.

JunitTest Success


Other links which may help you to solve this issue

I had to Google around quite a bit to find the solution. I noticed there are multiple causes for this issue. If the solution outlined in this blog did not help you, try one of these helpful links:
1. http://stackoverflow.com/questions/14539072/java-lang-noclassdeffounderror-org-hamcrest-selfdescribing
2. http://stackoverflow.com/questions/15190699/eclipse-junit-possible-causes-of-seeing-initializationerror-in-eclipse-windo


One thought on “%1$s”

Leave a Reply

Your email address will not be published. Required fields are marked *