title: Why do I get NoClassDefFoundError when running JMockit Mocks?
body: <p>I am running <strong>JMockit</strong> with <strong>Junit 4</strong> and get the error <code>java.lang.NoClassDefFoundError.</code> </p>
  
  <p>I want to test how my class (mycomponent) deals with values being returned from a 3rd party library static class. I am approaching this by creating the mocked class (mocked3rdpartycomponent) and then calling my mycomponent as below: </p>
  
  <p>mytest->mycomponent->mocked3rdpartycomponent</p>
  
  <p>The mocked class has the definition as follows. The mocked method and class is to substitute the before mentioned 3rd party library: </p>
  
  <pre><code>new Mockup&lt;MockedClass&gt;() {
    @Mock public ReturnType[] mockedMethod() {
      ReturnType[] ni = {null};
      return ni;
    }
  }
  
  Mycomponent mc = new MyComponent();
  </code></pre>
  
  <p>When I run my test class I get the following error:</p>
  
  <pre><code>java.lang.NoClassDefFoundError: mockit/internal/state/TestRun
  at &lt;MockedClass.mockedMethod&gt;(MockedClass.java)
  at &lt;MyComponent&gt;.&lt;init&gt;
  caused by: java.lang.ClassNotFoundException: mockit.internal.state.TestRun
  </code></pre>
  
  <p><strong>Edit:</strong> In addition to this, if I try to step over the call in the Unit Under Test which should call my fake, a screen appears which states that source code for Junit cannot be found. </p>
  
  <p><strong>Edit:</strong> The third party library is also native with some static methods.</p>
  
  <p>Does anybody know what this could be caused by? </p>
  
  <p>My environment is Eclipse Mars 4.5.0, JUnit 4.10, JMockit 1.19. </p>
  
  <p>Thanks!</p>