Ubuntu Linux 安装JDK8 全步骤

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_74
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
java version "1.8.0_74"
Java(TM) SE Runtime Environment (build 1.8.0_74-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.74-b02, mixed mode)

  

相关推荐