title: Ant javac: package x does not exist, but i added the x.jar to the java build path libraries
body: <p>I opened an existing project using the ant buildfile. I got a lot of error about import x cannot be resolved. I don't have the src files for those in my project folder, but I have their compiled jar files. So I went to java build path -> libraries and used the add external JARs to add them to my project and all the error in my project went away.</p>
  
  <p>However, now when I build the project by running the ant file, i get  </p>
  
  <pre><code> [javac] Compiling 149 source files to X:\swt\documation\build
   [javac] X:\swt\documation\src\swt\documation\bookshelf\objectmodel\Trans.java:20: package utilities does not exist
   [javac] import utilities.StringUtils;
  </code></pre>
  
  <p>So the same files that gave me error but I though I fixed is giving me error again. What am I doing wrong? I added the jar file to the java build path library so why can't eclipse find these packages? </p>
  
  <p>This is the build.xml file.</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;project name="documation" basedir="." default="packageApplication"&gt;
  
      &lt;condition property="vob.prefix" value="/cm_data" else="X:"&gt;
          &lt;os family="unix" /&gt;        
      &lt;/condition&gt;
  
      &lt;property name="jar.keystore" value="${vob.prefix}/swt/cots/signJarKey"/&gt;
      &lt;property name="oracle.cots.dir" value="${vob.prefix}/swt/cots/oracle/oracle/9.2.0"/&gt;
      &lt;property name="utilities.dir" value="${vob.prefix}/swt/utilities/lib"/&gt;    
      &lt;property name="swt.mailer.dir" value="${vob.prefix}/swt/mailer/lib"/&gt;      
      &lt;property name="swt.logger.dir" value="${vob.prefix}/swt/logger/lib"/&gt;  
      &lt;property name="userprofile.dir" value="${vob.prefix}/swt/ups/lib"/&gt;    
      &lt;property name="apache.dir" value="${vob.prefix}/swt/cots/apache/apache/1.3.12"/&gt;   
      &lt;property name="jakarta.dir" value="${vob.prefix}/swt/cots/apache/jakarta"/&gt;    
      &lt;property name="frameworks.dir" value="${vob.prefix}/swt/cots/frameworks"/&gt;
      &lt;property name="spring.dir" value="${frameworks.dir}/spring"/&gt;
      &lt;property name="zk.dir" value="${frameworks.dir}/zk"/&gt;
      &lt;property name="junit.dir" value="${vob.prefix}/swt/cots/junit"/&gt;
      &lt;property name="vob.dir" value="."/&gt;
      &lt;property name="webapp.name" value="documation"/&gt;
      &lt;property name="src.dir" value="${vob.dir}/src"/&gt;
      &lt;property name="bin.dir" value="${vob.dir}/bin"/&gt;
  
      &lt;!-- This directory must be created view-private --&gt;            
      &lt;property name="build.dir" value="${vob.dir}/build"/&gt;
      &lt;property name="web.dir" value="${vob.dir}/webapps"/&gt;
      &lt;property name="dist.web.dir" value="${build.dir}/webapps"/&gt;    
      &lt;property name="lib.dir" value="${web.dir}/WEB-INF/lib"/&gt;
      &lt;property name="tomcat.home" value="${vob.prefix}/swt/cots/apache/tomcat/6.0.28"/&gt;  
      &lt;property name="dist.dir" value="${vob.dir}/dist"/&gt;
      &lt;property name="tmp.dir" value="${vob.dir}/temp"/&gt;
      &lt;property name="report.dir" value="${vob.dir}/webapps/reports"/&gt;
  
      &lt;path id="classpath"&gt;
          &lt;fileset dir="${junit.dir}"&gt;
              &lt;include name="*.jar"/&gt;
          &lt;/fileset&gt;     
          &lt;fileset dir="${jakarta.dir}"&gt;
              &lt;include name="*.jar"/&gt;
          &lt;/fileset&gt;     
          &lt;fileset dir="${apache.dir}"&gt;
              &lt;include name="*.jar"/&gt;
          &lt;/fileset&gt;    
          &lt;fileset dir="${swt.logger.dir}"&gt;
              &lt;include name="*.jar"/&gt;
          &lt;/fileset&gt;    
          &lt;fileset dir="${oracle.cots.dir}"&gt;
              &lt;include name="*.jar"/&gt;
          &lt;/fileset&gt;    
          &lt;fileset dir="${utilities.dir}"&gt;
              &lt;include name="*.jar"/&gt;
          &lt;/fileset&gt;
          &lt;fileset dir="${swt.mailer.dir}"&gt;
              &lt;include name="*.jar"/&gt;
          &lt;/fileset&gt;
          &lt;fileset dir="${userprofile.dir}"&gt;
              &lt;include name="*.jar"/&gt;
          &lt;/fileset&gt;
          &lt;fileset dir="${tomcat.home}"&gt;
              &lt;include name="servlet*.jar"/&gt;
          &lt;/fileset&gt;
          &lt;fileset dir="${frameworks.dir}"&gt;
              &lt;include name="*.jar"/&gt;
          &lt;/fileset&gt;
          &lt;fileset dir="${spring.dir}"&gt;
              &lt;include name="*.jar"/&gt;
          &lt;/fileset&gt;
          &lt;fileset dir="${zk.dir}"&gt;
              &lt;include name="*.jar"/&gt;
          &lt;/fileset&gt;
          &lt;fileset dir="${web.dir}/WEB-INF/lib"&gt;
              &lt;include name="*.jar"/&gt;
          &lt;/fileset&gt;        
          &lt;pathelement path="${build.dir}"/&gt;
      &lt;/path&gt;
  
      &lt;target name="packageApplication" description="tar all application files"
          depends="signJars" &gt;
          &lt;tar destfile="${dist.dir}/documation.tar"
           basedir="${tmp.dir}/webapp"
           includes="**"
          /&gt;
      &lt;/target&gt;
  
      &lt;target name="signJars" depends="appletJar"&gt;
              &lt;signjar jar="${tmp.dir}/${webapp.name}-applet.jar"
                       alias="dmsKey" 
                       keystore="${jar.keystore}" 
                       storepass="dmsKey" 
                       signedjar="${tmp.dir}/webapp/jsp/${webapp.name}-signed-applet.jar"
              /&gt;
              &lt;signjar jar="${vob.prefix}/swt/logger/lib/logger.jar"
                       alias="dmsKey" 
                       keystore="${jar.keystore}" 
                       storepass="dmsKey" 
                       signedjar="${tmp.dir}/webapp/jsp/logger-signed.jar"
              /&gt;
              &lt;signjar jar="${vob.prefix}/swt/cots/apache/jakarta/commons-httpclient-3.0.1.jar"
                       alias="dmsKey" 
                       keystore="${jar.keystore}" 
                       storepass="dmsKey" 
                       signedjar="${tmp.dir}/webapp/jsp/httpclient-signed.jar"
              /&gt;
              &lt;signjar jar="${vob.prefix}/swt/cots/apache/jakarta/commons-logging-api.jar" 
                       alias="dmsKey" 
                       keystore="${jar.keystore}" 
                       storepass="dmsKey" 
                       signedjar="${tmp.dir}/webapp/jsp/commonlogging-signed.jar"
              /&gt;
  
              &lt;signjar jar="${vob.prefix}/swt/cots/apache/jakarta/commons-codec-1.3.jar" 
                       alias="dmsKey" 
                       keystore="${jar.keystore}" 
                       storepass="dmsKey" 
                       signedjar="${tmp.dir}/webapp/jsp/commoncodec-signed.jar"
              /&gt;
      &lt;/target&gt;   
  
  
  
      &lt;target name="appletJar" depends="documationJar"&gt;
        &lt;jar destfile="${tmp.dir}/${webapp.name}-applet.jar"
             basedir="${build.dir}"
             includes="swt/documation/dms/webdocs/client/*.class"
        /&gt;
       &lt;/target&gt;  
  
  
    &lt;target name="documationJar" depends="zkStyleJar"&gt;
      &lt;jar destfile="${tmp.dir}/webapp/WEB-INF/lib/${webapp.name}.jar"
           basedir="${build.dir}"
          includes="swt/documation/bookshelf/**, swt/documation/dms/** swt/documation/objectmodel/** swt/documation/servlets/**" 
          excludes="swt/documation/dms/webdocs/client/*.class"
      /&gt;        
     &lt;/target&gt;    
  
      &lt;target name="zkStyleJar" depends="documationNGJar"&gt;
        &lt;jar destfile="${tmp.dir}/webapp/WEB-INF/lib/${webapp.name}-ZkStyle.jar"
             basedir="${web.dir}/zkStyle"
             includes="**"
        /&gt;
       &lt;/target&gt;  
  
  
      &lt;target name="documationNGJar" depends="compileBuildDir"&gt;
        &lt;jar destfile="${tmp.dir}/webapp/WEB-INF/lib/${webapp.name}NG.jar"
             basedir="${build.dir}"
          includes="swt/documation/ng/** swt/documation/service/** swt/documation/web/**" /&gt;    
     &lt;/target&gt;
  
      &lt;target name="compileBuildDir"  description="Compile main source tree java files" depends="copyToTmp"&gt;
          &lt;javac destdir="${build.dir}" target="1.5" debug="true"
                 deprecation="false" optimize="true" failonerror="true"&gt;
                 &lt;src path="${src.dir}"/&gt;
                  &lt;exclude name="test/swt/documation/service/**/*.java"/&gt;
              &lt;classpath refid="classpath"/&gt;
          &lt;/javac&gt;        
  
      &lt;/target&gt;   
  
  
      &lt;target name="copyToTmp" depends="cleanTmpDir"&gt;             
          &lt;copy todir="${tmp.dir}/webapp"&gt;
              &lt;fileset dir="${web.dir}"&gt;              
                  &lt;exclude name="**/classes/**"/&gt;
                  &lt;exclude name="**/lib/*.jar"/&gt;
                  &lt;exclude name="**/zkStyle/**"/&gt;
              &lt;/fileset&gt;
          &lt;/copy&gt;         
     &lt;/target&gt;
  
  
      &lt;target name="cleanTmpDir"&gt;
          &lt;delete&gt;
              &lt;fileset dir="${build.dir}" /&gt;
          &lt;/delete&gt; 
          &lt;delete&gt;
              &lt;fileset dir="${dist.dir}" /&gt;
          &lt;/delete&gt;
          &lt;delete&gt;
              &lt;fileset dir="${tmp.dir}" /&gt;
          &lt;/delete&gt;
          &lt;mkdir dir="${tmp.dir}/webapp"/&gt;
          &lt;mkdir dir="${tmp.dir}/webapp/lib"/&gt;
      &lt;/target&gt;
  
  
      &lt;target name="reports" description="Compiles all the XML report designs and produces the .jasper files."&gt;
          &lt;taskdef name="jrc" classname="net.sf.jasperreports.ant.JRAntCompileTask"&gt; 
              &lt;classpath refid="classpath"/&gt;
          &lt;/taskdef&gt;
          &lt;jrc destdir="${report.dir}"&gt;
              &lt;src&gt;
                  &lt;fileset dir="${report.dir}"&gt;
                      &lt;include name="**/*.jrxml"/&gt;
                  &lt;/fileset&gt;
              &lt;/src&gt;
              &lt;classpath refid="classpath"/&gt;
          &lt;/jrc&gt; 
      &lt;/target&gt;   
  
  &lt;/project&gt;
  </code></pre>