Ant is the most commonly used "make" facility for Java programs. After editing source programs, it's necessary to recompile. Ant checks the last change date on .class and .java files and recompiles source files where the .class date is older than the corresponding .java file.
Ant also supports many additional tasks, for example, running javadoc
to produce documentation, running tests, building jar files, ...
The action of ant is determined by a build.xml file.
A generic build.xml file is given below that might be
appropriate for student programs.
Ant is free from the Apache Software Foundation (ant.apache.org).
To install it on Windows unzip it into a directory (eg, C:\ant)
and set the following three environment variables (JAVA_HOME
should be set to where your JDK directory is).
Installation instructions can be found at ant/docs/manual/index.html
in the ant directory and online.
The environment variables ANT_HOME, JAVA_HOME, and PATH must be set (eg, Settings - Control Panel - System - Advanced - Environment Variables - System Variables).
ANT_HOME=c:\ant JAVA_HOME=c:\jdk1.4.2_04 To PATH add %ANT_HOME%\bin
Ant can be used from many IDEs, but I typically use it from a DOS/Command window.
ant as above.build.xml (see below) into your project directory.cd) to the directory containing your source files.ant to compile your source files.
The source="1.4" option is already specified so assertions are
enabled at compile time.java -ea YourProg" ("-ea" enables run-time assertions).build.xml fileFor simple development where the source and object files are in the same directory and there's no explicit package (typical student projec