Home » Apache Ant Hello World

Apache Ant Hello World

by Online Tutorials Library

Apache Ant Hello World

To create a simple hello world project, we are using Eclipse IDE and the project require the below steps.

  1. Create a Java Project
  2. Create a Java File
  3. Create an XML File
  4. Create a Folder
  5. Run as Ant Build

Java Project

Create a project by selecting Java project from the File menu and provide it’s name.

Apache Ant Hello World

Java File

Create a Java class by providing it’s name Hello, see the below example.

Apache Ant Hello World

XML File

Create an XML File by providing it’s name build. Build is a default name but we can set other name also.

Apache Ant Hello World

Create a Folder

Create a folder to organize compiled Java class files. The folder can be anything, here we have created a test folder.

Project Structure

After creating all the above files, our project should look like the below.

Apache Ant Hello World

In this project, Java and XML file contains the below code to display Hello World message.

// Hello.Java

// build.xml

Run Project

To run the project, right click in the build.xml file and select Run as → Ant Build. After running that, it shows the output in a specific format, see the below.

Apache Ant Hello World

Output:

Apache Ant Hello World

You may also like