The Sun JDK is no longer in Ubuntu's main package repository. In order to download it, you need to add the appropriate repository and indicate to the system which JDK should be used.

Java 6: for Gingerbread and newer

$ sudo add-apt-repository "deb lucid partner"$ sudo apt-get update$ sudo apt-get install sun-java6-jdk

Java 5: for Froyo and older

$ sudo add-apt-repository "deb hardy main multiverse"$ sudo add-apt-repository "deb hardy-updates main multiverse"$ sudo apt-get update$ sudo apt-get install sun-java5-jdk


所以需要使用 update-alternatives --config  这个命令来配置,配置的文件主要  java,javac,javadoc,javah,jar 这5个命令