ant installation

basel_amin

New Member
Directions for Installing Apache ANT and running the HelloWorld.java example:

You can download Apache Ant from the following locations:
http://ant.apache.org/
http://cvs.apache.org/builds/ant/nightly/

Apache Ant requires a JAXP-compliant XML parser installed
Apache Xerces2 xml parser:
* http://xml.apache.org/xerces2-j/index.html
* java.sun.com/xml


Step1: Download Apache Ant.

Step2: Make a directory /ANT
Un-Tar Apache Ant in that directory:
tar -zxvf apache-ant-1.6.0-bin.tar.gz

Step3: Set the Apache Environment variable ANT_HOME to:
setenv ANT_HOME /home/f85/username/ant/apache-ant-1.6.0

Set PATH to allow for ANT:
set path=($path $ANT_HOME/bin)

Set Java Home Environment variable JAVA_HOME to:
setenv JAVA_HOME=/usr/java/j2sdk1.4.2_02

Step4: Change directory to /ANT/apache-ant-1.6.0
Create a directory src: mkdir src

Step5: Change directory to src
Create a file called "HelloWorld.java"
NOTE: With java the class created in the file must match the file name
Place the following code in this file and save:

public class HelloWorld{

public static void main(String[] args){
System.out.println("Hello world!");
}//end main

}



Step6: Change directory back to ANT/apache-ant-1.6.0/bin
Create a file: build.xml
Cut and paste the code from the following webpage:
http://people.wm.edu/~dsbeav/

Step7: Run ./ant
This should compile HelloWorld.java and place in /classes a HelloWorld.class file
Also in ANT/bin there should a file called Beav_EX.jar
If you make changes to HelloWorld.class and rerun ANT the old HelloWorld.class will be deleted and replaced by the newer version.
 
عودة
أعلى