下方链接下载JDK
JDK下载 - 编程宝库 (codebaoku.com)
解压到指定目录
--javascripttypescriptbashsqljsonhtmlcssccppjavarubypythongorustmarkdown
mkdir -p /usr/lib/jdk
tar -zxvf jdk-8u341-linux-x64.tar.gz -C /usr/lib/jdk
vim /etc/profile
添加到文件
JAVA_HOME=/usr/lib/jdk/jdk1.8.0_341
CLASSPATH=
PATH:$JAVA_HOME/bin
export PATH JAVA_HOME CLASSPATH
执行profile 文件
source /etc/profile
java -version
卸载
检测jdk安装包
--javascripttypescriptbashsqljsonhtmlcssccppjavarubypythongorustmarkdown
rpm -qa | grep java
显示
java-1.7.0-openjdk-1.7.0.111-2.6.7.8.el7.x86_64
python-javapackages-3.4.1-11.el7.noarch
tzdata-java-2016g-2.el7.noarch
javapackages-tools-3.4.1-11.el7.noarch
java-1.8.0-openjdk-1.8.0.102-4.b14.el7.x86_64
java-1.8.0-openjdk-headless-1.8.0.102-4.b14.el7.x86_64
java-1.7.0-openjdk-headless-1.7.0.111-2.6.7.8.el7.x86_64
卸载openjdk
--javascripttypescriptbashsqljsonhtmlcssccppjavarubypythongorustmarkdown
[root@localhost software]# rpm -e --nodeps tzdata-java-2016g-2.el7.noarch
[root@localhost software]# rpm -e --nodeps java-1.7.0-openjdk-1.7.0.111-2.6.7.8.el7.x86_64
[root@localhost software]# rpm -e --nodeps java-1.7.0-openjdk-headless-1.7.0.111-2.6.7.8.el7.x86_64
[root@localhost software]# rpm -e --nodeps java-1.8.0-openjdk-1.8.0.102-4.b14.el7.x86_64
[root@localhost software]# rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.102-4.b14.el7.x86_64
或者
# yum remove *openjdk*
之后再次输入rpm -qa | grep java 查看卸载情况:
[root@localhost software]# rpm -qa | grep java
python-javapackages-3.4.1-11.el7.noarch
javapackages-tools-3.4.1-11.el7.noarch