Ant tool

What is the use of ant tool?

advantages than others

at what purpose we go for ant tool.

how to download that one.

how to test simple java program in that tool

LVL 9
Manikandan ThiagarajanSenior consultantAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

avinthmCommented:
Hi ,

Apache Ant is a Java-based build tool.
There is already make, gnumake, nmake, jam build tools.
Ant is OS independent which makes it more popular.

download from this site - http://ant.apache.org/bindownload.cgi
you will get a complete manual on how to use Ant - http://ant.apache.org/manual/index.html

cheers
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
avinthmCommented:
you can compile java files, build jar, build war or build ear using ant.
There are lot many uses of ant.
you can run JUnit test cases using Ant
0
avinthmCommented:
FAQ's - http://ant.apache.org/faq.html

Why the name ANT ? The name is an acronym for "Another Neat Tool".
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

avinthmCommented:
Ant is compatible with many IDEs like Eclipse, NetBeans, JBuilder, Gel, IntelliJ, WSAD.
What else can u expect from ANT ?
0
Manikandan ThiagarajanSenior consultantAuthor Commented:
i come to know that.

ant tool is create only one instance.

is it correct?
0
avinthmCommented:
> ant tool is create only one instance.
i didnt get your question
0
Manikandan ThiagarajanSenior consultantAuthor Commented:
could you tell me the advantages of ant tool
0
Manikandan ThiagarajanSenior consultantAuthor Commented:
could you Explain the instance creation in ant tool
0
avinthmCommented:
More About ant -
http://en.wikipedia.org/wiki/Apache_Ant
http://ant.apache.org/index.html

you will have to write a build script, usually named as build.xml.
then u can run this this script using ant command - ant build.xml

All the installation and usage details are given in the manual - http://ant.apache.org/manual/index.html
A sample build.xml -
<?xml version="1.0"?>
<project name="Hello" default="compile">
    <target name="clean" description="remove intermediate files">
        <delete dir="classes"/>
    </target>
    <target name="compile"
     description="compile the Java source code to class files">
        <mkdir dir="classes"/>
        <javac srcdir="." destdir="classes"/>
    </target>
    <target name="jar" depends="compile"
     description="create a Jar file for the application">
        <jar destfile="hello.jar">
            <fileset dir="classes" includes="**/*.class"/>
            <manifest>
                <attribute name="Main-Class" value="HelloProgram"/>
            </manifest>
        </jar>
    </target>
</project>
0
Mayank SAssociate Director - Product EngineeringCommented:
>> could you Explain the instance creation in ant tool

What do you mean by instance creation in Ant? Ant is not used for running programs, only for compiling/ building.
0
el_diosCommented:
Hi,

>> Ant is not used for running programs, only for compiling/ building.
You can use ant to run your code not just compiling.
Ant is a tool which helps in developing applications. It is very powerful and a de-facto standard in the industry. Say you want to build a war file, you need to compile the jsp move them to WEB-INF classes folder ....... and many other tasks. You can write an ant script to do all that. When many developers are developing the code then ant can be used to save a lot of effort. It is not a java code which we use (it is internally a java code though). We write build.xml files (you can change the name) and execute it on DOS prompt(in windows) like ant <option>.
0
Manikandan ThiagarajanSenior consultantAuthor Commented:
i have downloaded the ant tool


how could i compile and  run simple java program.

say my first.java file is under c:\mani

C:\Documents and Settings\mani\Desktop\apache-ant-1.6.5

this dir contains bin,lib,docs.

is it any gui environment is there in ant.

could you please explain simple
0
el_diosCommented:
For windows:-

set JAVA_HOME=<JAVA_HOME>
set ANT_HOME=<ANT_HOME>
set PATH=%PATH%;<JAVA_HOME>\bin;<ANT_HOME>\bin

Go to dos and type ant :- check if it gives you an error saying build file not found
Then u'll know your ant is working

A very simple tutorial : http://www.oracle.com/technology/oramag/oracle/02-nov/o62odev_ant.html

read this article this will help your understanding
http://www.javaworld.com/javaworld/jw-10-2000/jw-1020-ant-p2.html
if you can't follow we'll help.
0
Mayank SAssociate Director - Product EngineeringCommented:
>> You can use ant to run your code not just compiling.

Yes, but generally you would use Ant for web-applications, J2EE applications where many classes have to be compiled together and typically you would run them under an app-server (start-up servlet or based on the user's request, etc).
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.