首先从官网下载JDK 链接地址:
...sudo gedit ~/.bashrc
#Java Path
export JAVA_HOME=/home/pan60157/java/jdk1.6.0_45
export JRE_HOME=/home/pan60157/java/jdk1.6.0_45/jre
export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOME/bin
...sudo apt-get install open-jdk6
... sudo update-alternatives --install /usr/bin/java java /home/pan60157/java/jdk1.6.0_45/bin/java 300
sudo update-alternatives --install /usr/bin/jar jar /home/pan60157/java/jdk1.6.0_45/bin/jar 300
sudo update-alternatives --install /usr/bin/javah javah /home/pan60157/java/jdk1.6.0_45/bin/javah 300
sudo update-alternatives --install /usr/bin/javap javap /home/pan60157/java/jdk1.6.0_45/bin/javap 300
...sudo update-alternatives --config java,选jdk1.6.0_45为手动模式
...java -version (ok, it's all)