There are lots of legacy systems running on Java 5 and we can't forget that. It is also about freedom of choice. If you want to install Sun JDK 5 or 6 Ubuntu should not make your life difficult.
Ubuntu 10 and 11 don't allow us to natively (or easily) install Sun JDK's via apt-get.
It is so frustrate when we try to install it on Ubuntu 10.10 and have no luck:
sudo apt-get install sun-java5-jdk (or sudo apt-get install sun-java6-jdk)
After installed, the JDK will go to this directory: /usr/lib/jvm/java-6-sun
You can see all JDK's installed running the following command:
sudo update-java-alternatives -l
After a while, finally got the solution for this:
sudo add-apt-repository "deb http://us.archive.ubuntu.com/
sudo add-apt-repository "deb http://us.archive.ubuntu.com/
sudo apt-get update
sudo apt-get install sun-java5-jdk
Check it out just to confirm:
sudo update-java-alternatives -l
The commands above worked for me in Ubuntu 10 and 11, installing Sun JDK 1.5 and 1.6.
If it doesn't work, try to add the following repositories and repeat the process: (anonymous suggestion - thanks a lot):
sudo add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/ hardy multiverse"
sudo add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/ hardy-updates multiverse"
Cheers
Leonardo