安装
去官网下载jdk:
使用xshell的xftp上传到/root目录解压到当前目录
tar -zxvf jdk-8u181-linux-x64.tar.gz
之后在/etc/profile文件末尾添加
export JAVA_HOME=/root/jdk1.8.0_181export JRE_HOME=${JAVA_HOME}/jreexport CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/libexport PATH=${JAVA_HOME}/bin:$PATH
使/etc/profile生效
source /etc/profile
检测安装是否成功
[root@localhost ~]# java -versionjava version "1.8.0_181"Java(TM) SE Runtime Environment (build 1.8.0_181-b13)Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)[root@localhost ~]# javac用法: javac
卸载
查看已经安装的jdk
rpm -qa|grep jdk
java-1.8.0-openjdk-headless-1.8.0.65-3.b17.el7.x86_64java-1.7.0-openjdk-1.7.0.91-2.6.2.3.el7.x86_64java-1.7.0-openjdk-headless-1.7.0.91-2.6.2.3.el7.x86_64java-1.8.0-openjdk-1.8.0.65-3.b17.el7.x86_64
yum -y remove java-1.8.0-openjdk-headless-1.8.0.65-3.b17.el7.x86_64
卸载完成之后Java命令不被识别
java -version
bash: java: command not found...