title: NoClassDefFoundError: groovy/lang/binding
body: <p>I'm trying to evaluate Groovy script inside a Java app by using GroovyShell.</p>
  <p>Problem: My program compiles ok, but gives me a NoClassDefFoundError at run-time.</p>
  <p>TestClass.java:</p>
  <pre><code>import groovy.lang.Binding;
  import groovy.lang.GroovyShell;
  
  class TestClass {
      static Binding binding;
      static GroovyShell shell;
  
      public static void main(String[] args) {
          System.out.println(&quot;Hello, world.&quot;);
          binding = new Binding();
          shell = new GroovyShell(binding);
          Object value = shell.evaluate(&quot;5 ** 5&quot;);
      }
  }
  </code></pre>
  <p>Then I compile with:</p>
  <blockquote>
  <p>&gt; javac -cp %GROOVY_HOME%\embeddable\groovy-all-2.1.1.jar TestClass.Java</p>
  <p>&gt; jar cfm TestClass.jar Manifest.txt TestClass.class</p>
  </blockquote>
  <p>It compiles without error. Then I run it:</p>
  <blockquote>
  <p>&gt; java -jar TestClass.jar</p>
  </blockquote>
  <pre><code>Hello, world
  Exception in thread &quot;main&quot; java.lang.NoClassDefFoundError: groovy/lang/Binding
      at TestClass.main(TestClass.java:10)
  Caused by: java.lang.ClassNotFoundException: groovy.lang.Binding
      at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
  </code></pre>
  <p>Full error text: <a href="http://puu.sh/2gOrx" rel="nofollow noreferrer">http://puu.sh/2gOrx</a></p>
  <p>I've also tried running it with the same -cp as I compiled it, but it gives me the same error.</p>