title: How can include multiple jars in the classpath using ant?
body: <p>I have a bunch of .java files in a "src" folder that depend on three jars in a "lib" folder. I have the following build.xml file:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;project name="MyProj" basedir="."&gt;
   &lt;property name="src"   value="src"/&gt;
   &lt;property name="build" value="build"/&gt;
   &lt;property name="lib"   value="lib"/&gt;
  
  
   &lt;path id="master-classpath"&gt;
     &lt;fileset dir="${lib}"&gt;
       &lt;include name="activemq-all-5.1-SNAPSHOT.jar"/&gt;
       &lt;include name="geronimo-jms_1.1_spec-1.1.1.jar"/&gt;
       &lt;include name="activemq-core-5.3.0.jar"/&gt;
     &lt;/fileset&gt;
   &lt;/path&gt;
  
   &lt;javac destdir="${build}"&gt;
     &lt;src path="${src}"/&gt;
     &lt;classpath refid="master-classpath"/&gt;
   &lt;/javac&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>This compiles fine, but when I try and run I get </p>
  
  <blockquote>
    <p>"java.lang.NoClassDefFoundError:
    javax/jms/Destination"</p>
  </blockquote>
  
  <p>This program runs and compiles fine when I include the jars in the buildpath using Eclipse, though.</p>
  
  <p>EDIT: So I copied the jars into the folder that has the compiled classes. The class with the main method is NDriver.class. When I try:</p>
  
  <blockquote>
    <p>java -classpath
    ./geronimo-jms_1.1_spec-1.1.1.jar:./activemq-core-5.3.0.jar:./activemq-all-5.1-SNAPSHOT.jar
    NDriver</p>
  </blockquote>
  
  <p>This gives:</p>
  
  <blockquote>
    <p>Exception in thread "main"
    java.lang.NoClassDefFoundError:
    NDriver</p>
  </blockquote>
  
  <p>I'd appreciate any help.</p>