Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews Java Programming Language Interviews:Advanced JavaCore JavaEclipseFull Stack Developer (Java)HibernateIBM WebSphereInternationalization LocalizationJ2EEJ2MEJ2SEJavaJava ANTJava AppletJava BeansJava ClassesJava EJB ProgrammingJava Game DeveloperJava GUI FrameworkJava JNDIJava JNIJava JSP ProgrammingJava Message Service (JMS)Java Multi-ThreadingJava Networking - Sockets and RMIJava PatternsJava SecurityJava Server FacesJava Servlet ProgrammingJava Software EngineerJava Swing ProgrammingJava TechnicalJava ThreadsJava Transaction APIJava Web ServicesJavaMailJBossJDBCJMSJSFPortal and PortletRMISpring FrameworkSr.Java Web DeveloperStrutsSunOneSwing AWTSWT JFace
Copyright © 2018. All Rights Reserved
Java ANT Interview Question:
Tell me how to start to use Ant and provide a "Hello World" ant script?
Submitted by: AdministratorBefore 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”>
</target>
</project>
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
Submitted by: Administrator
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”>
</target>
</project>
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
Submitted by: Administrator
Copyright 2007-2025 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.