title: Getting Error "Package doesn't exists" while compiling ant build.xml
body: <p>I am new to ANT build and getting error "package org.testng.annotations does not exist" and "package org.openqa.selenium does not exist" on compiling ant build.xml. </p>
  
  <p>Here is build.xml</p>
  
  <pre><code>&lt;project name="TestNGProject" default="usage" basedir="."&gt;
  &lt;!-- ===============Initialize property============================ --&gt;
  &lt;property environment="env"/&gt;
  &lt;property name="ws.home" value="${basedir}"/
  &lt;property name="ws.jars" value="C:\Users\Documents\selenium-2.35.0\AllJars"/&gt;
  &lt;property name="test.dest" value="${ws.home}/build"/&gt;
  &lt;property name="test.src" value="${ws.home}/src"/&gt;
  &lt;property name="ng.results" value="test-output"/&gt;
  
  &lt;target name="setClassPath" unless="test.classpath"&gt;
     &lt;path id="classpath_jars"&gt;
        &lt;fileset dir="${ws.jars}" includes="*.jar"/&gt;
     &lt;/path&gt;
     &lt;pathconvert pathsep="."
      property="test.classpath"
      refid="classpath_jars"/&gt;
  &lt;/target&gt;
  
  &lt;target name="init" depends="setClassPath"&gt;
     &lt;tstamp&gt;
         &lt;format property="start.time" pattern="MM/dd/yyyy hh:mm aa"/&gt;
      &lt;/tstamp&gt;
  
     &lt;condition property="ANT"
         value="${env.ANT_HOME}/bin/ant.bat"
         else="${env.ANT_HOME}/bin/ant"&gt;
         &lt;os family="windows" /&gt;
     &lt;/condition&gt;
  
     &lt;!--taskdef name="testng" classpath="${test.classpath}"
          classname="org.testng.TestNGAntTask" /--&gt;
  
  &lt;/target&gt;
  
  &lt;!--all--&gt;
  &lt;target name="all"&gt;
  &lt;/target&gt;
  
  &lt;!--clean--&gt;
  &lt;target name="clean"&gt;
     &lt;delete dir="${test.dest}"/&gt;
  &lt;/target&gt;
  
  &lt;!--compile--&gt;
  &lt;target name="compile" depends="init, clean"&gt;
     &lt;delete includeemptydirs="true" quiet="true"&gt;
        &lt;fileset dir="${test.dest}" includes="**/*"/&gt;
     &lt;/delete&gt;
     &lt;echo message= "making dir..."/&gt;
         &lt;mkdir dir="${test.dest}"/&gt;
     &lt;echo message="classpath---------: ${test.classpath}"/&gt;
     &lt;echo message="compiling..."/&gt;
  
     &lt;javac
       includeantruntime="false"
       destdir="${test.dest}"
       srcdir="${test.src}"
       classpath="${test.classpath}"
      &gt;
    &lt;/javac&gt;
  &lt;/target&gt;
  
  &lt;!--build--&gt;
  &lt;target name="build" depends ="init"&gt;
  &lt;/target&gt;
  
  &lt;target name="run" depends ="compile"&gt;
  
  &lt;testng classpath="${test.classpath}:${test.dest}" suitename="suite"&gt;
       &lt;xmlfileset dir ="${ws.home}" includes="testng.xml"/&gt;
  &lt;/testng&gt;
  
  &lt;/target&gt;
  
  &lt;target name="usage"&gt;
  &lt;echo&gt;
     ant run will execute test case
  &lt;/echo&gt;
  &lt;/target&gt;
  
  &lt;path id="test.c"&gt;
     &lt;fileset dir="${ws.jars}" includes="*.jar"/&gt;
  &lt;/path&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>and here is the error list</p>
  
  <pre><code>[javac] Compiling 2 source files to C:\Users\workspace\TestNGProject\build
  [javac] C:\Users\workspace\TestNGProject\src\TestNGPackage\NewTestNG.j
  ava:3: error: package org.testng.annotations does not exist
  [javac] import org.testng.annotations.Test;
  [javac]                              ^
  [javac] C:\Users\workspace\TestNGProject\src\TestNGPackage\NewTestNG.j
  ava:4: error: package org.testng.annotations does not exist
  [javac] import org.testng.annotations.DataProvider;
  [javac]                              ^
  [javac] C:\Users\workspace\TestNGProject\src\TestNGPackage\NewTestNG.j
  ava:5: error: package org.testng.annotations does not exist
  [javac] import org.testng.annotations.BeforeClass;
  [javac]                              ^
  [javac] C:\Users\workspace\TestNGProject\src\TestNGPackage\NewTestNG.j
  ava:6: error: package org.testng.annotations does not exist
  [javac] import org.testng.annotations.AfterClass;
  [javac]                              ^
  [javac] C:\Users\workspace\TestNGProject\src\TestNGPackage\NewTestNG.j
  ava:7: error: package org.testng does not exist
  [javac] import static org.testng.AssertJUnit.assertEquals;
  [javac]                         ^
  [javac] C:\Users\workspace\TestNGProject\src\TestNGPackage\NewTestNG.j
  ava:7: error: static import only from classes and interfaces
  [javac] import static org.testng.AssertJUnit.assertEquals;
  [javac] ^
  [javac] C:\Users\workspace\TestNGProject\src\TestNGPackage\NewTestNG.j
  ava:9: error: package org.openqa.selenium does not exist
  [javac] import org.openqa.selenium.By;
  [javac]                           ^
  [javac] C:\Users\workspace\TestNGProject\src\TestNGPackage\NewTestNG.j
  ava:10: error: package org.openqa.selenium does not exist
  [javac] import org.openqa.selenium.WebDriver;
  [javac]                           ^
  [javac] C:\Users\workspace\TestNGProject\src\TestNGPackage\NewTestNG.j
  ava:11: error: package org.openqa.selenium does not exist
  [javac] import org.openqa.selenium.WebElement;
  [javac]                           ^
  [javac] C:\Users\workspace\TestNGProject\src\TestNGPackage\NewTestNG.j
  ava:12: error: package org.openqa.selenium.firefox does not exist
  [javac] import org.openqa.selenium.firefox.FirefoxDriver;
  [javac]                                   ^
  [javac] C:\Users\workspace\TestNGProject\src\TestNGPackage\NewTestNG.j
  ava:16: error: cannot find symbol
  [javac]     private WebDriver driver;
  [javac]             ^
  [javac]   symbol:   class WebDriver
  [javac]   location: class NewTestNG
  [javac] C:\Users\workspace\TestNGProject\src\TestNGPackage\NewTestNG.j
  ava:17: error: cannot find symbol
  [javac]       private WebElement FahrenheitInput;
  [javac]               ^
  [javac]   symbol:   class WebElement
  [javac]   location: class NewTestNG
  [javac] C:\Users\workspace\TestNGProject\src\TestNGPackage\NewTestNG.j
  ava:18: error: cannot find symbol
  [javac]       private WebElement CelsiusInput;
  [javac]               ^
  [javac]   symbol:   class WebElement
  [javac]   location: class NewTestNG
  [javac] C:\Users\workspace\TestNGProject\src\TestNGPackage\NewTestNG.j
  ava:19: error: cannot find symbol
  [javac]       private WebElement ConvertButton;
  [javac]               ^
  [javac]   symbol:   class WebElement
  [javac]   location: class NewTestNG
  [javac] C:\Users\workspace\TestNGProject\src\TestNGPackage\sample.java
  :3: error: package org.testng.annotations does not exist
  [javac] import org.testng.annotations.Test;
  [javac]                              ^
  [javac] C:\Users\workspace\TestNGProject\src\TestNGPackage\NewTestNG.j
  ava:20: error: cannot find symbol
  [javac]       @BeforeClass
  [javac]        ^
  [javac]   symbol:   class BeforeClass
  [javac]   location: class NewTestNG
  [javac] C:\Users\workspace\TestNGProject\src\TestNGPackage\NewTestNG.j
  ava:29: error: cannot find symbol
  [javac]       @DataProvider(name = "CelsToFahrDP")
  [javac]        ^
  [javac]   symbol:   class DataProvider
  [javac]   location: class NewTestNG
  [javac] C:\Users\workspace\TestNGProject\src\TestNGPackage\NewTestNG.j
  ava:33: error: cannot find symbol
  [javac]       @Test(dataProvider = "CelsToFahrDP")
  [javac]        ^
  [javac]   symbol:   class Test
  [javac]   location: class NewTestNG
  [javac] C:\Users\workspace\TestNGProject\src\TestNGPackage\NewTestNG.j
  ava:40: error: cannot find symbol
  [javac]       @AfterClass
  [javac]        ^
  [javac]   symbol:   class AfterClass
  [javac]   location: class NewTestNG
  [javac] C:\Users\workspace\TestNGProject\src\TestNGPackage\sample.java
  :6: error: cannot find symbol
  [javac]   @Test
  [javac]    ^
  [javac]   symbol:   class Test
  [javac]   location: class sample
  [javac] C:\Users\workspace\TestNGProject\src\TestNGPackage\NewTestNG.j
  ava:22: error: cannot find symbol
  [javac]          driver = new FirefoxDriver();
  [javac]                       ^
  [javac]   symbol:   class FirefoxDriver
  [javac]   location: class NewTestNG
  [javac] C:\Users\workspace\TestNGProject\src\TestNGPackage\NewTestNG.j
  ava:25: error: cannot find symbol
  [javac]          CelsiusInput = driver.findElement(By.xpath("//form[2]/cente
  r[2]/input"));
  [javac]                                            ^
  [javac]   symbol:   variable By
  [javac]   location: class NewTestNG
  [javac] C:\Users\workspace\TestNGProject\src\TestNGPackage\NewTestNG.j
  ava:26: error: cannot find symbol
  [javac]          FahrenheitInput = driver.findElement(By.xpath("//form[2]/ce
  nter[2]/input[2]"));
  [javac]                                               ^
  [javac]   symbol:   variable By
  [javac]   location: class NewTestNG
  [javac] C:\Users\workspace\TestNGProject\src\TestNGPackage\NewTestNG.j
  ava:27: error: cannot find symbol
  [javac]          ConvertButton = driver.findElement(By.xpath("//form[2]/cent
  er[2]/input[3]"));
  [javac]                                             ^
  [javac]   symbol:   variable By
  [javac]   location: class NewTestNG
  [javac] 24 errors
  </code></pre>
  
  <p>I have also set the JAVA_HOME C:\Program Files\Java\jdk1.7.0_25\bin and ANT_HOME C:\Users\Documents\selenium-2.35.0\apache-ant-1.9.2</p>
  
  <p>Can anyone tell me how to get rid of this error.</p>