Knowledge Base/Tools/Ant

 

From Quantitative Finance

Jump to: navigation, search

A sample Ant script

<?xml version="1.0"?>
<project name="MyProject" default="compile">
	<target name="clean" description="Remove intermediate files">
		<delete dir="classes"/>
	</target>
	<target name="compile" description="Compile the source code">
		<mkdir dir="classes"/>
		<javac srcdir="src" destdir="classes"/>
	</target>
	<target name="jar" description="Create a Jar file for the project">
		<fileset dir="classes" includes="**/*.class"/>
		<manifest>
			<attribute name="Main-Class" value="HelloWorld"/>
		</manifest>
	</target>
</project>

"Unable to find a javac compiler" on using Ant Build in Eclipse

Go to Window > Preferences... then drill down to Ant > Runtime in the Preferences dialog box. Go to the Classpath tab. Select "Global Entries" and click on "Add External JARs...". Browse to <JDK directory>/lib/tools.jar. tools.jar will now appear under "Global Entries". Click "OK". The problem should now be resolved.

 
 
Google
 
Personal tools