title: How do I diagnose Java ClassNotFound exception happening in scripting languages but not Java code
body: <p>I am trying to use Joda Time in Java on Windows. I've downloaded Joda Time 1.2 and put the JAR on my CLASSPATH:</p>
  
  <pre><code>PS D:\Java\Jars&gt; $env:CLASSPATH
  .;C:\Program Files\Java\jre6\lib\ext\QTJava.zip;D:\Java\Jars\joda-time-2.1.jar
  </code></pre>
  
  <p>The following Java code works perfectly:</p>
  
  <pre><code>import org.joda.time.*;
  
  class Foo {
      public static void main (String[] args) {
          System.out.println("Hello, world");
          DateTime d = new DateTime();
          DateTime b = new DateTime(1981,12,25,0,0);
          Period p = new Period(b,d);
          System.out.println(p.toString());
      }
  }
  </code></pre>
  
  <p>However, when I try to import joda time from a scripting language, I get ClassNotFound errors.</p>
  
  <p>Jython:</p>
  
  <pre><code>PS D:\Java\Jars&gt; java -jar .\jython.jar
  Jython 2.5.2 (Release_2_5_2:7206, Mar 2 2011, 23:12:06)
  [Java HotSpot(TM) Client VM (Sun Microsystems Inc.)] on java1.6.0_31
  Type "help", "copyright", "credits" or "license" for more information.
  &gt;&gt;&gt; from org.joda.time import DateTime
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  ImportError: No module named joda
  &gt;&gt;&gt; import os
  &gt;&gt;&gt; os.getenv("CLASSPATH")
  '.;C:\\Program Files\\Java\\jre6\\lib\\ext\\QTJava.zip;D:\\Java\\Jars\\joda-time-2.1.jar'
  </code></pre>
  
  <p>Clojure:</p>
  
  <pre><code>PS D:\Java\Jars&gt; java -jar .\clojure-1.4.0.jar
  Clojure 1.4.0
  user=&gt; (import (org.joda.time DateTime Period))
  ClassNotFoundException org.joda.time.DateTime  java.net.URLClassLoader$1.run (:-1)
  </code></pre>
  
  <p>How can I diagnose what is going wrong here? Presumably there is something specific to the scripting environments that is causing the issue. I know Python, but I'm not very familiar with the Java-interop aspects of Jython. I know little about Clojure beyond enough to set up the above test.</p>
  
  <p>The classpath within Jython seems fine, as shown.</p>