Ubuntu14安装JDK1.7

下载

wget --no-check-certificate --no-cookie --header "Cookie: oraclelicense=accept-securebackup-cookie;" http://download.oracle.com/otn/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz

这种方法已失效,只能通过其他方法下载。

安装配置

mkdir /usr/lib/jvm
tar zxvf jdk-7u80-linux-x64.tar.gz -C /usr/lib/jvm

/etc/profile

# Set Java environmenet
export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_80
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=${CLASSPATH}:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${PATH}:${JAVA_HOME}/bin
source profile
sudo update-alternatives --install /usr/bin/java java $JAVA_HOME/bin/java 300
sudo update-alternatives --install /usr/bin/javac javac $JAVA_HOME/bin/javac 300
java -version

推荐阅读更多精彩内容