ubuntu server 14.04 上安装jdk1.8
ubuntu server 14.04 上安装jdk1.8
1.使用apt-get安装oracle-jdk安装oracle jdk
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java # 时间比较久,需要耐心等待
sudo apt-get install software-properties-common
sudo apt-get update
# 版本选择
Oracle JDK 6(旧版本)
sudo apt-get install oracle-java6-installer
Oracle JDK 7(较新的稳定版本)
sudo apt-get install oracle-java7-installer
Oracle JDK 8(最新预览版本 推荐)
sudo apt-get install oracle-java8-installer
2.通过下载tar.gz二进制文件来安装
mkdir /usr/local/java
cd /usr/local/java
jdk8.131下载地址http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz
编辑把jdk路径加入环境变量:
vim /etc/profile
export JAVA_HOME=/usr/local/java/jdk1.8.0_131
export PATH=$JAVA_HOME/bin:$PATH
source /etc/profile
验证是否配置成功
# java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
# echo $JAVA_HOME
/usr/local/java/jdk1.8.0_131