title: Invalid or corupt jarfile
body: <p>I tried to create a jar file from a java project, which uses some external jars. I created a lib folder and put all the jars I need there.</p>
  
  <p>I run the project in eclipse by adding all the jars in the lib folder to the Build Path and it works ok.</p>
  
  <p>When I try to create the jar with ant from build.xml, it seems ok, no error is shown.</p>
  
  <p>When I try to run the jar, I get the message "Invalid or corupt jarfile".</p>
  
  <p>In build.xml:
  I define the path to use for compiling:</p>
  
  <pre><code>&lt;path id="project.classpath"&gt;  
       &lt;fileset dir="${lib}"&gt;
           &lt;include name="**/*.jar"/&gt;
       &lt;/fileset&gt;
  &lt;/path&gt;
  </code></pre>
  
  <p>This is the target for the compilation:</p>
  
  <pre><code>&lt;target name="compile" depends="init" description="compile the source " &gt;
      &lt;!-- Compile the java code from ${src} into ${build} --&gt;
      &lt;javac srcdir="${src}" destdir="${build}"&gt;  
            &lt;classpath refid="project.classpath"/&gt;  
      &lt;/javac&gt;  
  &lt;/target&gt;
  </code></pre>
  
  <p>And this is the target for making the jar file:</p>
  
  <pre><code>&lt;target name="dist" depends="compile" description="generate the distribution" &gt;
        &lt;mkdir dir="${dist}"/&gt;
        &lt;!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file --&gt;
        &lt;jar jarfile="${dist}/MyProject-${DSTAMP}.jar" basedir="${build}"&gt; 
            &lt;manifest&gt;
              &lt;attribute name="Main-Class" value="${main}" /&gt;
              &lt;attribute name="Class-Path:" value="lib/**/*.*"/&gt;
            &lt;/manifest&gt;
            &lt;fileset dir="${src}" includes="images/**/*.*" /&gt;
         &lt;/jar&gt;
         &lt;echo file="${dist}/start.bat" message="java -jar MyProject-${DSTAMP}.jar" /&gt;
    &lt;/target&gt;
  </code></pre>
  
  <p>Can you please tell me what have I done wrong?</p>