centos下jdk、jre安装

1.在/usr/目录下创建java目录

[root@localhost ~]# mkdir/usr/java

[root@localhost ~]# cd /usr/java

2.下载jdk,然后解压

http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz?AuthParam=1507435402_60cf411062e7197de41768be28f4fccf

[root@localhost java]# tar -zxvf jdk-8u144-linux-x64.tar.gz

3.设置环境变量

[root@localhost java]# vi /etc/profile

在profile中添加如下内容:

#set java environment

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.验证JDK和jre有效性

[root@localhost ~]# 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)

[root@localhost ~]# javac -version

javac 1.8.0_144

上一篇:[1] 从零开始 TensorFlow 学习


下一篇:以太坊remix-ide本地环境搭建