本文的JDK6安装方法同样适用于Ubuntu 14.04
1. 到Oracle网站上下载一个java6-jdk的二进制安装包
我下载到的是:jdk-6u38-ea-bin-b04-linux-amd64-31_oct_2012.bin
目前的链接是这个:https://jdk6.java.net/download.html
如果链接不好用就不要找我了,鬼知道Oracle会不会变动这个。。。
2. 在/usr/lib/jvm下新建目录用于安装java6
sudo mkdir -p /usr/lib/jvm/java
sudo cp jdk-6u38-ea-bin-b04-linux-amd64-31_oct_2012.bin /usr/lib/jvm/java/jdk-6u38-ea-bin-b04-linux-amd64-31_oct_2012.bin
sudo chmod a+x /usr/lib/jvm/java/jdk-6u38-ea-bin-b04-linux-amd64-31_oct_2012.bin
cd /usr/lib/jvm/java sudo ./jdk-6u38-ea-bin-b04-linux-amd64-31_oct_2012.bin
echo "export PATH=$PATH:/usr/lib/jvm/java/jdk1.6.0_38/bin" >> ~/.bashrc echo "export CLASSPATH=$CLASSPATH:/usr/lib/jvm/java/jdk1.6.0_38/lib" >> ~/.bashrc echo "export JAVA_HOME=/usr/lib/jvm/java/jdk1.6.0_38" >> ~/.bashrc source ~/.bashrc
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java/jdk1.6.0_38/bin/java 300 sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java/jdk1.6.0_38/bin/javac 300 sudo update-alternatives --install /usr/bin/javah javah /usr/lib/jvm/java/jdk1.6.0_38/bin/javah 300 sudo update-alternatives --config java
java -version
来查看当前的JAVA环境。