Http://www.douban.com/group/topic/13498481/
JDK 1.6 is required for compiling android2.2, but if you have installed a later version of JDK, it is not as good as, how can you switch and install it, the following are the solutions to this problem:
A. Switch the version:
Switch JDK version, sudo Update-alternatives -- config Java
Sudo Update-alternatives -- config javac
B. Install jdk1.5.
1. To install jdk1.5, add the following content to the end of the/etc/APT/sources. list file.
Deb http://tw.archive.ubuntu.com/ubuntu/ jaunty main restricted universe multiverse
The Deb-Src http://tw.archive.ubuntu.com/ubuntu/ jaunty main restricted universe multiverse
2. sudo apt-Get update
3. sudo apt-Get install sun-java5-jdk
4. comment out the two rows added in/etc/APT/sources. List.
5. sudo apt-Get update
6. Export java_home =/usr/lib/JVM/Java-1.5.0-Sun (depending on the specific installation path)
7. Export android_java_home = $ java_home
After the above steps, you have installed JDK and can continue to compile android.