【Aliyun】安装Oracle JDK

2017-09-23  本文已影响0人  chevy

1.下载
[root@localhost ~]$ curl -O http://download.oracle.com/otn-pub/java/jdk/8u144/ jdk-8u144-linux-x64.rpm

2.使用rpm命令安装

[root@localhost ~]# rpm -ivh jdk-8u144-linux-x64.rpm
Preparing... ########################################### [100%]
1:jdk ###########################################[100%]
Unpacking JAR files...
rt.jar...
jsse.jar...
charsets.jar...
tools.jar...
localedata.jar...
jfxrt.jar...

3.设置环境变量
[root@localhost java]# vi /etc/profile
添加如下内容:

JAVA_HOME=/usr/java/jdk1.8.0_144
JRE_HOME=/usr/java/jdk1.8.0_144/jre
CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH
让修改生效:

[root@localhost java]# source /etc/profile
4.验证

[root@localhost java]# java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

上一篇下一篇

猜你喜欢

热点阅读