title: Ant not recognizing JUnit jar in its lib directory?
body: <p>I'm using Cygwin under Windows XP, and I'm trying to get Ant to use JUnit without coding any classpath entries for it. The doc for JUnit says I can:</p>
  
  <blockquote>
    <p>Put both junit.jar and ant-junit.jar in ANT_HOME/lib.</p>
  </blockquote>
  
  <p>My handy-dandy copy of JUnit in Action says:</p>
  
  <blockquote>
    <p>You may have noticed that you don't explicitly add the JUnit JAR to the classpath. Remember that when you installed Ant, you copied the JUnit JAR file to the ${ANT_HOME}/lib directory in order to use the junit Ant task. Because junit.jar is already on your classpath, you don't need to specify it in the javac task to compile your tests.</p>
  </blockquote>
  
  <p>$ANT_HOME is set to the Ant installation directory. In the lib subdirectory, I see ant-junit.jar (installed with Ant) and junit-4.9.jar (copied by me). Seems okay, right? But the test compile step fails:</p>
  
  <pre><code>[javac] Compiling 1 source file to E:\tools\ctg\bin\test
  [javac] E:\tools\ctg\src\test\TestAll.java:3: package org.junit does not exist
  [javac] import org.junit.*;
  </code></pre>
  
  <p>Et cetera. I tried renaming junit-4.9.jar to junit.jar. No joy. I peeked in the jar file and saw that the package does exist inside of it. In fact, the compiles work fine if I explicitly include that very jar file in the Ant classpath.</p>
  
  <p>Bleh. Any thoughts about what might be wrong? Thanks.</p>
  
  <p>EDIT: By request, here's the javac target:</p>
  
  <pre><code>&lt;path id="classpath"&gt;
     &lt;pathelement location="${app-bin}"/&gt;
     &lt;pathelement location="${test-bin}"/&gt;
     &lt;!--pathelement location="${junit-bin}"/--&gt;
  &lt;/path&gt;
  
  &lt;target name="compile-test" depends="compile-app"&gt;
     &lt;javac srcdir="${test-src}"
            destdir="${test-bin}"
            source="${java}"
            target="${java}"
            debug="on"
            includeantruntime="false"&gt;
        &lt;compilerarg value="-Xlint"/&gt;
        &lt;classpath refid="classpath"/&gt;
     &lt;/javac&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p>Note that the JUnit binary is commented out. My goal is to delete it and have the compile work.</p>