java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing
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=
According to the JUnit GitHub team website (https://github.com/junit-team/junit/wiki/Download-and-Install), junit.jar
and hamcrest-core.jar
are both needed in the classpath when using JUnit 4.11.
Here is the Maven dependency block for including junit and hamcrest.
<dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.1.2</version> <scope>test</scope></dependency><!-- Needed by junit --><dependency> <groupId>org.hamcrest</groupId> <artifactId>hamcrest-all</artifactId> <version>1.3</version> <scope>test</scope></dependency>
A few steps you have to follow:
- Right click on the project.
- Choose Build Path Then from its menu choose Add Libraries.
- Choose JUnit then click Next.
- Choose JUnit4 then Finish.