JDK安装及配置教程(Linux版)
本文介绍JDK安装及配置Linux版教程,具体步骤如下:
一、准备jdk文件
下载链接:https://pan.baidu.com/s/1hCoVTd0IaKuMfplsRoVQxw
提取码:nw0r
温馨提示:也可在附件下载jdk文件。
二、开始安装
将上面下载的tar包放置root目录

创建soft目录:mkdir soft

解压缩:tar xzvf jdk-8u231-linux-x64.tar.gz -C soft


三、进行环境变量配置
命令:vi /etc/profile


在末尾新增以下内容:
JAVA_HOME=/root/soft/jdk1.8.0_231
JRE_HOME=$JAVA_HOME/jre
CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib
PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export PATH CLASSPATH JAVA_HOME JRE_HOME

四、生效操作
source /etc/profile

五、检查jdk配置是否生效
java -version

至此,linux中jdk配置完成,以下是操作命令:
[root@localhost ~]# history
1 halt(忽略)
2 pwd
3 ll
4 mkdir soft
5 ll
6 tar xzvf jdk-8u231-linux-x64.tar.gz -C soft/
7 vi /etc/profile
8 source /etc/profile
9 java -version
10 history
[root@localhost ~]#