title: New to Ant, ClassNotFoundException with JUnit
body: <p>I've been scratching my head over this for a while now (Googled a bunch, looked through other related SO posts to no avail). I have a Java program comprised of two files, <code>Logic</code> and <code>Tests</code>. <code>Tests</code> contains about a hundred JUnit tests, and I've gotten 100% success rate with said tests by calling <code>javac *.java</code> followed by <code>java org.junit.runner.JUnitCore Tests</code>. However when I run my <code>build.xml</code> with a simple <code>ant -verbose test</code> (in order to follow the output since I'm new to all this), I get the following output:</p>
  
  <pre><code>[junit] Testsuite: Tests
  [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
  [junit] 
  [junit] Null Test:  Caused an ERROR
  [junit] Tests
  [junit] java.lang.ClassNotFoundException: Tests
  [junit]     at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
  [junit]     at java.lang.Class.forName0(Native Method)
  [junit]     at java.lang.Class.forName(Class.java:247)
  [junit] 
  [junit] 
  [junit] Test Tests FAILED
  
  BUILD SUCCESSFUL
  </code></pre>
  
  <p>My <code>build.xml</code> is as follows:</p>
  
  <pre><code>&lt;project name="ETL_Automation" default="test" basedir="."&gt;
  
  &lt;path id="classpath.base"&gt;
  &lt;/path&gt;
  
  &lt;path id="classpath.test"&gt;
    &lt;pathelement location="${basedir}/mysql-connector-java-5.1.18-bin.jar" /&gt;
    &lt;pathelement location="${basedir}/junit-4.10.jar"/&gt;
    &lt;path refid="classpath.base" /&gt;
  &lt;/path&gt;
  
  &lt;target name="compile"&gt;
    &lt;javac srcdir="${basedir}"&gt;
      &lt;classpath refid="classpath.test"/&gt;
    &lt;/javac&gt;
  &lt;/target&gt;
  
  &lt;target name="test" depends="compile"&gt;
    &lt;junit fork="no"&gt;
      &lt;classpath refid="classpath.test" /&gt;
      &lt;formatter type="brief" usefile="false" /&gt;
      &lt;batchtest&gt;
        &lt;fileset dir="${basedir}/" includes="Tests.class" /&gt;
      &lt;/batchtest&gt;
    &lt;/junit&gt;
  &lt;/target&gt;
  
  &lt;target name="clean" depends="test"&gt;
    &lt;delete&gt;
      &lt;fileset dir="${basedir}" includes="*.class"/&gt;
    &lt;/delete&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p></p>
  
  <p>The directory structure is pretty straightforward. <code>Tests.java</code>, <code>Logic.java</code>, <code>junit-4.10.jar</code>, <code>mysql-connector-java-5.1.18-bin.jar</code>, <code>build.xml</code>, and a referenced <code>.properties</code> file are all in  the same folder. The java code references external files but those are unrelated to this particular issue. I don't know if the classpath could be the cause of this issue (as I'm pretty convinced what I currently have doesn't work).</p>
  
  <p>Thanks!</p>