Platinum Partner
ant,tutorial

Ant Eclipse IDE Integration

To integrate Ant build file with the Eclipse IDE, first create a build.xml file, right click the project select New->Other->XML, enter the name as build.xml and click Finish.

<?xml version="1.0" ?> 
<project name="Ant Example" default="execute">

	<target name="init" depends="clean">
		<mkdir dir="build/classes" />
	</target>

	<target name="compile" depends="init">
		<javac srcdir="src" destdir="build/classes" />
	</target>
	
	<target name="execute" depends="compile">
		<java classname="com.vaannila.helloworld.HelloWorld" classpath="build/classes" />
	</target>

	<target name="clean">
		<delete dir="build" />
	</target>
	
</project>

To build the project right click the build.xml file and select Ant Build.

The HelloWorld.java file will be compiled and executed. The following message shows the sequence of events that happen once the build file is executed.

<?xml version="1.0" ?> 
<project name="Ant Example" default="execute">

	<target name="init" depends="clean">
		<mkdir dir="build/classes" />
	</target>

	<target name="compile" depends="init">
		<javac srcdir="src" destdir="build/classes" />
	</target>
	
	<target name="execute" depends="compile">
		<java classname="com.vaannila.helloworld.HelloWorld" classpath="build/classes" />
	</target>

	<target name="clean">
		<delete dir="build" />
	</target>
	
</project>

You can download the build file here.

Build file :Download
Project :Download
{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}