JDK1.8安装

使用rpm包安装jdk1.8.151

1.下载rpm包

jdk-8u151-linux-x64.rpm

2.安装

[root@test ~]# rpm -ivh jdk-8u151-linux-x64.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:jdk1.8-2000:1.8.0_151-fcs        ################################# [100%]
Unpacking JAR files...
    tools.jar...
    plugin.jar...
    javaws.jar...
    deploy.jar...
    rt.jar...
    jsse.jar...
    charsets.jar...
    localedata.jar...

 

3.添加软连接

ln -s /usr/java/jdk1.8.0_151/ /usr/java/jdk

4.全局路径设置

echo 'export JAVA_HOME=/usr/java/jdk'>>/etc/profile
echo 'export JRE_HOME=${JAVA_HOME}/jre'>>/etc/profile
echo 'export PATH=$JAVA_HOME/bin:$PATH'>>/etc/profile
echo 'export CLASSPATH=.:${JAVA_HOME}/lib/dt:$JAVA_HOME/lib/tools.jar:${JRE_HOME}/lib:$JAVA_HOME/jre/lib/ext'>>/etc/profile

5.设置的路径生效

source /etc/profile

6.验证

[root@test ~]# java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)

 

posted @ 2018-06-25 20:27  Blue_Smile  阅读(225)  评论(0编辑  收藏  举报