johnnian / Blog

MyBlog
Mozilla Public License 2.0
208 stars 59 forks source link

CentOS 7 安装JDK #53

Open johnnian opened 6 years ago

johnnian commented 6 years ago

JDK 1.8 下载地址:

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

安装步骤:假设下载的JDK文件名是:jdk-8u171-linux-x64.tar.gz

1、 将 jdk-8u171-linux-x64.tar.gz 拷贝到/root 目录下,进行解压

[root@localhost ~]# tar -xzvf jdk-8u171-linux-x64.tar.gz 

2、将解压出来的文件夹剪切到/usr/share 目录下

[root@localhost ~]# mv jdk1.8.0_171 /usr/share/ 

3、 设置环境变量

[root@localhost ~]# vi /etc/bashrc 
#添加下面代码
JAVA_HOME=/usr/share/jdk1.8.0_171 
CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib 
PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH 
export PATH CLASSPATH JAVA_HOME 

4、 使修改立即生效


[root@localhost ~]# source /etc/bashrc 
duqicauc commented 6 years ago

👍