- 下载 Oracle jdk 需要到Oracle (http://www.oracle.com/)
- tar –zxvf jdk-8u111-linux-x64.gz
sudo mv ./jdk1.8.0_111 /opt/Java - 配置环境变量:
sudo gedit ~/.bashrc打开文件,在文件末尾添加下面语句
export JAVA_HOME=/opt/Java/jdk1.8.0_111
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
保存退出,source ~/.bashrc java –version查看是否安装成功