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"
sudo apt-get update
sudo apt-get install sun-java5-jdk
It took a while, some unrelated warnings were fired, but at the end it was installed. After the installation was finished I just did:
sudo update-alternatives --config java
and switched to java5
which was one of the alternatives.
Hope it helps.NelsonPS. You should be able to go back to java 6 after that just by issuing an uptade-alternatives call.
from: http://serverfault.com/questions/293392/need-to-install-sun-java5-jdk-on-ubuntu-11-04
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package sun-java6-jdk is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package sun-java6-jdk has no installation candidate
说是Ubuntu 10.04已经去掉sun-java6-jdk 和sun-java6-jre的软件包
记得在国外某个论坛看到说,这个包已经从2012-2-26就移走了。
最后实现办法
1、添加这个源:
sudo add-apt-respository "deb http://us.archive.ubuntu.com/ubuntu/ hardy multiverse"
2、sudo apt-get update3、sudo apt-get install sun-java6-jdk OK了
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu hardy-updates main multiverse"
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk