You may be surprised to learn Ant requires GCJ when installed through Synaptic or
apt on Ubuntu. GCJ is GNU’s Java compiler. When you’re using Sun’s JDK and compiler, GCJ can get in the way – at worst it creates conflicts; at best it causes confusion.
Here’s how I installed Ant on Ubuntu without GCJ. Be sure to check out (easier) alternatives suggested in the comments, below.
- Download the current `.tar.bz2` distribution of Ant from http://www.ibiblio.org/pub/mirrors/apache/ant/binaries/.
- Unpack archive using `tar`.
- Move the unpacked directory to `/usr/local/ant`.
- Change that directory's owner to `root`.
- Add the following lines to `/etc/bash.bashrc`.
From a new shell, run
ant. You should see the following:
Buildfile: build.xml does not exist!
Yes, it’s a failure message. But it means Ant is working as expected. :)