The symptoms are:
$ ant -version
Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-6-openjdk/lib/tools.jar
Apache Ant version 1.7.1 compiled on November 10 2008
and
$ java -version
java version "1.6.0_0"
OpenJDK Runtime Environment (IcedTea6 1.4.1) (6b14-1.4.1-0ubuntu10)
OpenJDK Server VM (build 14.0-b08, mixed mode)
The easiest way to solve this for me was to force Sun's “original” JDK.
Apparently, once you've installed
sun-java6-bin, -jre and -jdk packages, you have to$ sudo update-java-alternatives -s java-6-sun
and then edit
/etc/jvm so that it looks something like this, with /usr/lib/jvm/java-6-sun on top:
/usr/lib/jvm/java-6-sun
/usr/lib/jvm/java-gcj
/usr/lib/jvm/ia32-java-1.5.0-sun
/usr/lib/jvm/java-1.5.0-sun
/usr