Centos 安装 JDK


1.登陆Oracle官网,下载 jdk-8u201-linux-x64.tar.gz

https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html


2.解压

[root@docker ~]# ls
jdk-8u201-linux-x64.tar.gz
[root@docker ~]# tar -zxvf jdk-8u201-linux-x64.tar.gz -C /usr/local

3.编辑/etc/profile,修改环境变量

export JAVA_HOME=/usr/local/jdk1.8.0_201
export JRE_HOME=/usr/local/jdk1.8.0_201/jre
export CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin

4.重读配置文件立即生效,查看验证

[root@docker ~]# source /etc/profile
[root@docker ~]# java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)

 

你可能感兴趣的:(Linux)