View RSS Feed

My Java Tips

  1. Simple Ant script

    by , 11-19-2011 at 04:49 PM (My Java Tips)
    Let us see how to write a simple ant script for a Java application. Write a simple HelloWorld Java class


    HelloWorld.Java
    Java Code:
    public class HelloWorld
    {
     	public static void main(String args[])
      	{
       		System.out.println("HelloWorld!");
      	}
    }
    By default Ant uses build.xml as the name for a buildfile. This is the build.xml.
    Java Code:
    <project default="compile">
    
      	<target name="compile">
    ...
    Categories
    Ant
  2. Ant Project

    by , 11-19-2011 at 04:43 PM (My Java Tips)
    In this post, I will present a sample build.xml file for a simple Java "Hello, world" application and will explain the ANT project.


    Java Code:
    <project name="HelloWorld" default="compile">
    
      	<target name="compile">
        		<javac srcdir=".">
      	</javac></target>
    
        	<target name="run" depends="jar">
        		<java classname="HelloWorld">
    ...
    Categories
    Ant
  3. ANT properties

    by , 11-18-2011 at 06:23 PM (My Java Tips)
    A project in a build.xml can have a set of properties. This property has a name and a value. In which the name of the property is case-sensitive. Properties can be used in the value of task attributes. It is done by putting the property name between "${" and "}" in the attribute value. For example, if there is a "builddir" property with the value "build", then this could be used in an attribute like this: ${builddir}/classes. At run-time this is resolved as ...

    Updated 11-18-2011 at 06:26 PM by Java Tip

    Categories
    Ant