1. 根据系统32 /64 ,下载jdk-6u27-linux-x64.bin
2.
$ sudo cp jdk-6u27-linux-i586.bin /usr/lib/jvm
$ cd /usr/lib/jvm
$ sudo ./jdk-6u27-linux-i586.bin
$ sudo mv jdk1.6.0_27/ java-1.6.0_27-sun/
$ sudo ln -s java-1.6.0_27-sun java-6-sun
$ sudo rm jdk-6u27-linux-i586.bin
配置文件修改:
$ sudo vi /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/java-6-sun/bin"
CLASSPATH="/usr/lib/jvm/java-6-sun/lib"
JAVA_HOME="/usr/lib/jvm/java-6-sun"
更该使用的jdk路径:
$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-6-sun/bin/java 300
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/java/java-6-sun/bin/javac 300
$ sudo update-alternatives --config java
------------------------------------------------------------
0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 ×Ô¶¯Ä£Ê½
1 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 ÊÖ¶¯Ä£Ê½
* 2 /usr/lib/jvm/java-6-sun/bin/java 300 ÊÖ¶¯Ä£Ê½
确认是否安装成功:
$ java -version
java version "1.6.0_27"
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) Server VM (build 20.2-b06, mixed mode)