java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing

user2013948 picture user2013948 · Jan 26, 2013 · Viewed 146.4k times · Source

While running junit test in eclipse I am getting this Exception:

java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing

I've added junit.jar library file.

I've tried different versions of junit.jar: 4.4, 4.8, etc.

How do I fix this Exception?

Answer

Jiacai Liu picture Jiacai Liu · Sep 28, 2013

Add hamcrest-all-X.X.jar to your classpath.

Latest version as of Feb 2015 is 1.3: http://code.google.com/p/hamcrest/downloads/detail?name=hamcrest-all-1.3.jar&can=2&q=