ubuntu下安装jdk环境
1、下载jdk8
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2、创建目录
sudo mkdir /usr/lib/jvm
并解压jdk到上面目录
sudo tar -zxvf jdk-8u74-linux-x64.tar.gz -C /usr/lib/jvm
3、修改系统环境变量
sudo vim ~/.bashrc
or sudo gedit ~/.bashrc
文件末尾添加:
#set oracle jdk environment
export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_191
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
马上生效变量
source ~/.bashrc
4、测试是否正常安装
java -version
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)