wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u65-b17/jdk-8u65-linux-x64.tar.gz
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz
3、配置jdk环境变量:
在启动终端并输入
- gedit /etc/profile
在末尾添加一下配置,保存并退出
#set jdk environment export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_21 export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$CLASSPATH export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
终端输入一下命令使配置生效
source /etc/profile
4、查看配置是否成功。在终端输入
- java -version
如果显示版本是1.7.0.21则配置成功,如下显示:
- java version "1.7.0_21"
- Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
- Java HotSpot(TM) Server VM (build 23.21-b01, mixed mode)