HOWTO Installing Ant on Windows

From WikiTechia

(Redirected from Installing Ant on Windows)
Jump to: navigation, search

Ant is a build utility based around XML and JAVA. This makes it a versatile and cross-platform built utility, so how do we go about Installing Ant on windows?

Contents

JAVA

JAVA is required by Ant.

Note: JDK is probably desirable since Ant is more than likely being used to be build JAVA based applications.

Adding JAVA_HOME

An environment variable needs to be set, JAVA_HOME, which needs to contain the directory to which JAVA was installed.

  • Control Panel->System->Advanced->Environment Variables
  • Click New under System Variables
  • Name: JAVA_HOME
  • Value: C:\Program Files\Java\jdk1.5.0_07
  • Click OK

Ant

Ant is required.

Note: The Current Release of Ant in zip archive format is what is needed.

Extract Ant to a directory

Ant needs to be unziped into a directory. Note: The directory must be in DOS 8.3 format, so no spaces in the directory path and no long file names. Hence the following would be a poor choice

c:\Program Files\Ant

Something along the lines should be used

c:\Ant

Note: the zip archive already has an ant directory in it, make sure that when it is extracted, the folder is renamed and moved the directory structure so it looks something like this

c:\ant
    +---bin
    |
    +---docs
    |
    +---etc
    |
    +---lib

The easiest way to do this is to simply extact the zip to the root c:\ and then rename the directory apache-ant-x.x.x to ant.

Increasing environment variable space

Ant makes extensive usage of environment variables and by default, there isn't much room for that in windows.

Open config.sys file in your root windows drive, most likely c:\ and add the following line

shell=c:\command.com c:\ /p /e:32768

The above line has the expectation your root drive is c:\

Adding ANT_HOME

Another environment variable needs to be set, ANT_HOME, which needs to contain the directory to which ant was installed.

  • Control Panel->System->Advanced->Environment Variables
  • Click New under System Variables
  • Name: ANT_HOME
  • Value: c:\ant
  • Click OK

Adding Ant to path

So that Ant can be called from any directory, the ant\bin directory needs to be added to the system path.

  • Control Panel->System->Advanced->Environment Variables
  • Under System Variables, a variable named Path can be found. Select it and click Edit.

It may look something like this

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem

Append to the end of that, the directory to ant's bin directory

;%ANT_HOME%\bin

So the result would be

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%ANT_HOME%\bin

See also

External Links

Personal tools