Without Book Interview Questions and Answers | Online Test | Moct Test
Download Android App in your Android Device from Google Play Store
- Search for "Withoutbook Practice Exam Test" in Mobile/Tablet Play Store
Institute Training Search by Name or Email

Exams Attended

Make Homepage

Bookmark this page

Subscribe Email Address

ANT Interview Questions and Answers

Ques 1. What is ANT?

Ans. ANT full form is Another Needed Tool. Ant is a build tool that is java based. A build tool performs the following tasks:

Compiling java code into byte code
Placing this byte code in a package
Deployment to production systems
Document creation and release notes preparation.

Is it helpful? Add Comment View Comments
Ques 2. Explain ANT functionality.
Ans. Ant is an open source project available under the Apache license. Therefore, its source code can be downloaded and modified. 

Additionally, Ant uses XML build files which make its development easy.
Cross Platform.

Use of XML along with Java makes Ant makes it the perfect solution for developing programs designed to run or be built across a range of different operating systems.

New tasks are used to extend the capabilities of the build process, while build listeners are used to help hook into the build process to add extra error tracking functionality.

As Ant is extensible and open, it can be integrated with any editor or development environment easily.
Is it helpful? Add Comment View Comments
Ques 3. Explain using ANT and give an small example.
Ans. Before start using ANT, we should be clear about the project name and the .java files and most importantly, the path where the .class files are to be placed.

For example, we want the application HelloWorld to be used with ant. The Java source files are in a subdirectory called Dirhelloworld, and the .class files are to put into a sub directory called Helloworldclassfiles.

1. The build file by name build.xml is to be written. The script is as follows

<project name=”HelloWorld” default=”compiler” basedir=”.”> 
<target name=”compiler”> 
<mkdir dir = “Helloworldclassfiles”> 
<javac srcdir=”Dirhelloworld” destdir=”Helloworldclassfiles”> 

2. Now run the ant script to perform the compilation:

C :\\> ant
Buildfile: build.xml

and see the results in the extra files and directory created:

c:\\>dir Dirhelloworld
c:\\>dir Helloworldclassfiles

All the .java files are in Dirhelloworld directory and all the corresponding .class are in Helloworldclassfiles directory.

Note: mkdir command is to be used in MS-DOS and mk dir command is to be used in UNIX/Linux

Dir command is to be used in MS-DOS and ls command is to be used in UNIX /Linux
Is it helpful? Add Comment View Comments
Ques 4. How to set Classpath in Ant script?
Ans. The following is the code snippet to set the classpath in ant:

<path id=”build.classpath”>
<fileset dir=”${build.lib}” includes=”**/*.jar/>
<fileset dir=”${build.class”}/>

<classpath field=”build.classpath”/>

<classpath field=”build.classpath”/>
Is it helpful? Add Comment View Comments
Ques 5. How to set property file in Ant script?
Ans. <!-- Import properties from build.properties -->
<property name=\"build.properties\" value=\"${basedir}/conf/build.properties\" />
<fail message=\"Missing build.properties file: please use -Dbuild.properties=/path/to/file\">
<available file=\"${build.properties}\" type=\"file\" />
<property file=\"${build.properties}\" />
Is it helpful? Add Comment View Comments

Most helpful rated by users:

©2017 WithoutBook