I worked with Ketan Padegaonkar on creating a wrapper around the JDT compiler.
Usually, you would call it by installing the compiler jar, and reference it while calling the java compiler:
java -classpath org.eclipse.jdt.core_3.2.0.jar org.eclipse.jdt.internal.compiler.batch.Main -classpath rt.jar A.java
Granted ruby and rubygems are installed on your system, installing JDTc is easy:
sudo gem install jdtc
JDTc installs the compiler for you, and places it at a convenient location. Then running the JDT compiler is a bit easier:
jdtc -classpath rt.jar A.java
A bit easier, hey ?
Using the ECJ jar with Ant is another way.
Put something like:
build.compiler=org.eclipse.jdt.core.JDTCompilerAdapter
in a properties file, include it in your build.xml:
and add the ECJ jar to the Ant classpath.
The idea is to get away from Ant actually. More about it soon.