title: JUnit - java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing
body: <p>I am using Win 7 and downloaded Junit 4.13 and hamcrest 2.1 from 
  <a href="https://github.com/junit-team/junit4/wiki/Download-and-Install" rel="nofollow noreferrer">https://github.com/junit-team/junit4/wiki/Download-and-Install</a></p>
  
  <p>and put them in a folder named JUnit under C.</p>
  
  <p>I have added the variable: JUNIT_HOME with value C:\JUnit.</p>
  
  <p>I have also added the following to my classpath:</p>
  
  <pre><code>%classpath%;.;C:\Program Files\Java\jre1.8.0_171\bin;%CLASSPATH%; 
  %JUNIT_HOME%\junit-4.13-beta-1;.; %JUNIT_HOME%\hamcrest-core-2.1.jar;
  </code></pre>
  
  <p>Following <a href="https://github.com/junit-team/junit4/wiki/Getting-started" rel="nofollow noreferrer">https://github.com/junit-team/junit4/wiki/Getting-started</a>,
  I added the java files Calculator.java and CalculatorTest.java to my practice folder. </p>
  
  <p>The command </p>
  
  <pre><code>javac -cp .;junit-4.13-beta-1.jar;hamcrest-core-2.1.jar CalculatorTest.java
  </code></pre>
  
  <p>is executed successfully. However, the command</p>
  
  <pre><code>java -cp .;junit-4.13-beta-1.jar;hamcrest-core-2.1.jar org.junit.runner.JUnitCore CalculatorTest
  </code></pre>
  
  <p>Fails, giving an error message like</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: 
  org/hamcrest/SelfDescribing
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClass(Unknown Source)
      at java.security.SecureClassLoader.defineClass(Unknown Source)
      at java.net.URLClassLoader.defineClass(Unknown Source)
      at java.net.URLClassLoader.access$100(Unknown Source)
      at java.net.URLClassLoader$1.run(Unknown Source)
      at java.net.URLClassLoader$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at org.junit.runner.Computer.getSuite(Computer.java:28)
      at org.junit.runner.Request.classes(Request.java:77)
      at org.junit.runner.JUnitCommandLineParseResult.createRequest(JUnitComma
  ndLineParseResult.java:116)
      at org.junit.runner.JUnitCore.runMain(JUnitCore.java:77)
      at org.junit.runner.JUnitCore.main(JUnitCore.java:36)
  Caused by: java.lang.ClassNotFoundException: org.hamcrest.SelfDescribing
      at java.net.URLClassLoader.findClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      ... 17 more
  </code></pre>
  
  <p>Please note I have checked posts like <a href="https://stackoverflow.com/questions/14539072/java-lang-noclassdeffounderror-org-hamcrest-selfdescribing">java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing</a>, but they have not been helpful. Could you please help?</p>