JDK安装
环境
Ubuntu 16.04 LTS
安装
ppa(源)安装
我采用的是安装包安装,使用ppa安装的方法可参照:http://www.cnblogs.com/a2211009/p/4265225.html
安装包安装
- 下载对应的.gz包
http://www.oracle.com/technetwork/articles/javase/index-jsp-138363.html - 解压缩
tar -zxvf jdk-8u144-linux-x64.tar.gz
- 放到指定目录
sudo mkdir /usr/lib/java
mv jdk1.8.0_144 /usr/lib/java/
- 设置环境变量
sudo vim ~/.bashrc
追加以下内容:
#set oracle jdk environment
export JAVA_HOME=/usr/lib/java/jdk1.8.0_144
export JAVA_BIN=/usr/lib/java/jdk1.8.0_144/bin
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
使其生效:
source ~/.bashrc
测试
参考:
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
http://blog.csdn.net/licongcong_0224/article/details/12756959/
http://www.cnblogs.com/a2211009/p/4265225.html