Installation problem of ant

booloo Posted messages 100 Status Member -  
latunardedu69 Posted messages 5 Status Member -
Hello,
I downloaded Apache Ant to start my Java EE project, but the installation is giving me trouble. Here is what I did:

c:\>set ANT_HOME=c:\Tools\ant\apache-ant-1.7.1
c:\>echo %ANT_HOME%
c:\>ant -version
'ant' is not recognized as an internal or external command

Your help would be very precious to me please.
Configuration: Windows Vista Internet Explorer 7.0

7 answers

  1. sandul Posted messages 4013 Status Member 723
     
    Setting ANT_HOME alone is not enough to be able to run ant.bat => you must add the path to the ant.bat folder to the PATH variable. Example
    c:\>set path=%path%;%ANT_HOME%\bin


    ++
    0
    1. booloo Posted messages 100 Status Member
       
      Just a small remark my dear Sandul:
      while typing ant -version this is what the command window shows:
      c:\>ant -version
      Unable to located tools.jar. Expected to find it in C:\program Files\Java\jre6\lib6\tools.jar
      Apache ant version 1.7.1 compiledon June 27 2008

      Another issue, please your clarification would be precious to me.
      0
  2. booloo Posted messages 100 Status Member
     
    Thank you my friend, I managed to install Ant thanks to your help.
    Bravo.
    0
  3. sandul Posted messages 4013 Status Member 723
     
    Unable to locate tools.jar. Expected to find it in C:\program Files\Java\jre6\lib6\tools.jar
    Apache Ant version 1.7.1 compiled on June 27 2008
    <==

    You need to install the JDK. Suppose you have the following structure:
    C: |---bin |----java |----ant

    and the JDK is installed in c:\bin\java. Define the following environment variables:
    ANT_HOME=C:\bin\ant ANT_BIN=%ANT_HOME%\bin JAVA_HOME=C:\bin\java JAVA_BIN=%JAVA_HOME%\bin JAVA_INCLUDE=%JAVA_HOME%\include
    (the last variable is not needed in your case, but useful in others)

    The path should include the path to ANT_BIN and JAVA_BIN.

    ++
    0
  4. booloo Posted messages 100 Status Member
     
    I have the JDK in my java directory and I did everything you told me, but I’m getting the same error.

    The path must include the path to ANT_BIN and JAVA_BIN. (this is the syntax, because I couldn't write that)

    Best regards.

    ps: I’ll get there
    0
  5. java4ever
     
    Hello,
    The problem is that Tools is in the JDK and not the JRE.
    therefore just one thing is missing, the JAVA_HOME declaration:
    this must point to the root of the JDK:
    For example (change the path by replacing it with yours) :

     SET JAVA_HOME=C:\Program Files\Java\jdk1.5.0_17 


    good luck
    0
  6. booloo Posted messages 100 Status Member
     
    Well done my friend!
    I succeeded, when I typed:
    C:\>ant -version
    apache Ant version 1.7.1 compiled on June 27 2008

    Felicitations, I restarted the computer and there are no errors
    Thanks to all of you
    0
  7. latunardedu69 Posted messages 5 Status Member
     
    Hello,

    I didn’t quite understand where to modify ANT_HOME. Is it in the ant.bat?

    here’s what I did:

    :checkCDrive
    rem check for ant in C:\ant for Win9X users
    if not exist "C:\Documents and Settings\Administrateur\Bureau\apache-ant-1.8.2-bin\apache-ant-1.8.2\lib\ant.jar" goto noAntHome
    set ANT_HOME ="C:\Documents and Settings\Administrateur\Bureau\apache-ant-1.8.2-bin\apache-ant-1.8.2"
    set path=%path%;%ANT_HOME%\bin
    set ANT_BIN=%ANT_HOME%\bin
    SET JAVA_HOME="C:\Program Files\Java\jdk1.6.0_26"
    set JAVA_INCLUDE=%JAVA_HOME%\include
    set JAVA_BIN=%JAVA_HOME%\bin

    goto checkJava

    but I still get the error ANT_HOME set incorrectly or ant could not be located.
    please set ANT_HOME

    could you help me?
    0