Linux安装配置JDK8

安装的JDK:jdk-8u102-linux-x64.rpm

下载地址:http://pan.baidu.com/s/1mi8QZeK

安装(JDK默认安装在/usr/java中)

[root@iZ94zsv4mnfZ ~]# rpm -ivh jdk-8u102-linux-x64.rpm

验证

[root@iZ94zsv4mnfZ ~]# java -version
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)
[root@iZ94zsv4mnfZ ~]#

配置环境变量

[root@iZ94zsv4mnfZ ~]# vim /etc/profile
文件末尾添加以下内容

export JAVA_HOME=/usr/java/jdk1.8.0_102
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

使配置生效

[root@iZ94zsv4mnfZ ~]# source /etc/profile

相关推荐