Sunday, September 28, 2014

How to Build a Jar File With Build.xml

Instructions

    1

    Create a source directory for your project, containing subfolders named "src," "lib," and "build."

    2

    Write a simple "Hello World" program, and save the file in the "src" folder under the name "test.java":

    class HW

    public static void main(String[] args)

    System.out.println("Hello World");

    3

    Create a file called "build.xml" in the main project directory, and include the following line of code:

    4

    Write the project root tags in the build.xml file:


    5

    Add the following code into the "project" section of the build.xml file. This code defines the dependencies for the build file and compiles the test.java file:



    6

    Save the build file, then execute it by navigating a command terminal to the main project directory and entering the command "ant."



No comments:

Post a Comment