title: java project not working after ant build
body: <p>I am new in Java, spent on this problem too much time, can't solve it:</p>
  
  <p>I run <code>build.xml</code> file in Eclipse Java project. Project successfully built, all tests passed, but after that project not working, seems to be that something wrong happens with .classpath file, cause if I change build path settings (e.g. delete libs and add again), everything works...</p>
  
  <p>build.xml file
  `
  </p>
  
  <pre><code>&lt;!-- Sets variables which can later be used. --&gt;
  &lt;!-- The value of a property is accessed via ${} --&gt;
  &lt;property name="src.dir" location="src" /&gt;
  &lt;property name="build.dir" location="build" /&gt;
  &lt;property name="dist.dir" location="dist" /&gt;
  &lt;property name="test.report.dir" location="test report" /&gt;
  
  &lt;!-- Define the classpath which includes --&gt;
  &lt;path id="junit.class.path"&gt;
  
      &lt;!-- needed libs --&gt;
      &lt;pathelement location="lib/commons-dbcp.jar" /&gt;
      &lt;pathelement location="lib/commons-logging.jar" /&gt;
      &lt;pathelement location="lib/commons-pool.jar" /&gt;
      &lt;pathelement location="lib/log4j-1.2.15.jar" /&gt;
      &lt;pathelement location="lib/mysql-connector-java-5.1.6-bin.jar" /&gt;
      &lt;pathelement location="lib/spring.jar" /&gt;
      &lt;pathelement location="lib/spring-webmvc.jar" /&gt;
      &lt;pathelement location="lib/standard.jar" /&gt;
  
      &lt;!-- JUnit 3-4 --&gt;
      &lt;pathelement location="C:\Program Files\eclipse\plugins\org.junit_4.8.1.v4_8_1_v20100427-1100\junit.jar" /&gt;
      &lt;pathelement location="C:\Program Files\eclipse\plugins\org.junit_3.8.2.v3_8_2_v20100427-1100\junit.jar" /&gt;
  
      &lt;!-- repository-config.xml --&gt;
      &lt;pathelement location="config" /&gt;
  
      &lt;!-- classes after compiling --&gt;
      &lt;pathelement location="${build.dir}" /&gt;
  &lt;/path&gt;
  
  &lt;!-- Deletes the existing build, docs and dist directory--&gt;
  &lt;target name="clean"&gt;
      &lt;delete dir="${build.dir}" /&gt;
      &lt;delete dir="${dist.dir}" /&gt;
      &lt;delete dir="${test.report.dir}" /&gt;
  &lt;/target&gt;
  
  &lt;!-- Creates the  build, docs and dist directory--&gt;
  &lt;target name="makedir"&gt;
      &lt;mkdir dir="${build.dir}" /&gt;
      &lt;mkdir dir="${dist.dir}" /&gt;
      &lt;mkdir dir="${test.report.dir}" /&gt;
  &lt;/target&gt;
  
  &lt;!-- Compiles the java code (including the usage of library for JUnit --&gt;
  &lt;target name="compile" depends="clean, makedir"&gt;
      &lt;javac srcdir="${src.dir}" destdir="${build.dir}"&gt;
          &lt;classpath refid="junit.class.path" /&gt;
      &lt;/javac&gt;
  &lt;/target&gt;
  
  &lt;!--Creates the deployable jar file  --&gt;
  &lt;target name="jar" depends="compile"&gt;
      &lt;jar destfile="${dist.dir}\empdb.build.ant.jar" basedir="${build.dir}"&gt;
      &lt;/jar&gt;
  &lt;/target&gt;
  
  &lt;!-- Run the JUnit Tests --&gt;
  &lt;!-- Output is XML, could also be plain--&gt;
  &lt;target name="junit" depends="jar"&gt;
      &lt;junit printsummary="on" fork="true" haltonfailure="yes"&gt;
          &lt;classpath refid="junit.class.path" /&gt;
          &lt;formatter type="xml" /&gt;
          &lt;batchtest todir="${test.report.dir}"&gt;
              &lt;fileset dir="${src.dir}"&gt;
                  &lt;include name="**/*Test*.java" /&gt;
              &lt;/fileset&gt;
          &lt;/batchtest&gt;
      &lt;/junit&gt;
  &lt;/target&gt;
  
  &lt;target name="main" depends="junit"&gt;
      &lt;description&gt;Main target&lt;/description&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p>
  `</p>
  
  <p>This is the error on one of tests after project build</p>
  
  <pre><code>Class not found sef.test.repository.StubProjectRepositoryImplTest
  java.lang.ClassNotFoundException: sef.test.repository.StubProjectRepositoryImplTest
      at java.net.URLClassLoader$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:693)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:429)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
  </code></pre>