title: No main manifest attribute using ant to run .jar file?
body: <p>There are many threads on here about the "no main manifest attribute" error but none were really of any help.</p>
  
  <p>For starters, I am working on this with ssh so I'm not using eclipse whatsoever.  Here is my build.xml file I'm running:</p>
  
  <pre><code>&lt;project name="MergeSortTester" basedir="." default="main"&gt;
  
      &lt;property name="src.dir"        value="src"/&gt;
      &lt;property name="build.dir"      value="build"/&gt;
      &lt;property name="classes.dir"    value="${build.dir}/classes"/&gt;
      &lt;property name="jar.dir"        value="${build.dir}/jar"/&gt;
      &lt;property name="main-class"     value="com.doublell.MergeSortTester"/&gt;
  
  
      &lt;target name="clean"&gt;
              &lt;delete dir="${build.dir}"/&gt;
      &lt;/target&gt;
  
      &lt;target name="compile"&gt;
              &lt;mkdir dir="${classes.dir}"/&gt;
              &lt;javac srcdir="${src.dir}" destdir="${classes.dir}"/&gt;
      &lt;/target&gt;
  
      &lt;target name="jar" depends="compile"&gt;
              &lt;mkdir dir="${jar.dir}"/&gt;
              &lt;jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${classes.dir}"&gt;
                      &lt;manifest&gt;
                              &lt;attribute name="Main_class" value="${main-class}"/&gt;
                      &lt;/manifest&gt;
              &lt;/jar&gt;
      &lt;/target&gt;
  
      &lt;target name="run" depends="jar"&gt;
              &lt;java jar="${jar.dir}/${ant.project.name}.jar" fork="true"/&gt;
      &lt;/target&gt;
  
      &lt;target name="clean-build" depends="clean,jar"/&gt;
      &lt;target name="main" depends="clean,run"/&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>At the start of every .java file in my src directory I have:</p>
  
  <pre><code>package com.doublell;
  </code></pre>
  
  <p>When I enter the the "ant" command into bash I get:</p>
  
  <pre><code>Buildfile: /home/students/khaines/GitHubRepos/DoubleLinkedList/build.xml
  
  clean:
     [delete] Deleting directory /home/students/khaines/GitHubRepos/DoubleLinkedList/build
  
  compile:
      [mkdir] Created dir: /home/students/khaines/GitHubRepos/DoubleLinkedList/build/classes
      [javac] /home/students/khaines/GitHubRepos/DoubleLinkedList/build.xml:15: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
      [javac] Compiling 11 source files to /home/students/khaines/GitHubRepos/DoubleLinkedList/build/classes
      [javac] Note: /home/students/khaines/GitHubRepos/DoubleLinkedList/src/MergeSortTester.java uses unchecked or unsafe operations.
      [javac] Note: Recompile with -Xlint:unchecked for details.
  
  jar:
      [mkdir] Created dir: /home/students/khaines/GitHubRepos/DoubleLinkedList/build/jar
        [jar] Building jar: /home/students/khaines/GitHubRepos/DoubleLinkedList/build/jar/MergeSortTester.jar
  
  run:
       [java] no main manifest attribute, in /home/students/khaines/GitHubRepos/DoubleLinkedList/build/jar/MergeSortTester.jar
       [java] Java Result: 1
  
  main:
  
  BUILD SUCCESSFUL
  Total time: 1 second
  </code></pre>
  
  <p>I suspect the problem lies with package names, I've never even manually declared a package name before. Yes, MergeSortTester.java is the class with the main method.</p>
  
  <p>Also, I've been primarily focused on just getting one .jar file to run, but really id like to be able create two .jar files(by adding another driver class that uses the same other classes that MergeSortTester.java uses) and have separate run commands for each jar file.</p>