一。卸載java
1.rpm -qa|grep jdk ,查看安裝的jdk的組件node
[root@host-10-20-88-228 ~]# rpm -qa|grep jdk copy-jdk-configs-3.3-10.el7_5.noarch java-1.8.0-openjdk-devel-1.8.0.191.b12-0.el7_5.x86_64 java-1.8.0-openjdk-headless-1.8.0.191.b12-0.el7_5.x86_64 java-1.8.0-openjdk-1.8.0.191.b12-0.el7_5.x86_64
2.rpm -e --nodeps 卸載命令linux
[root@host-10-20-88-228 ~]# rpm -e --nodeps copy-jdk-configs-3.3-10.el7_5.noarch [root@host-10-20-88-228 ~]# rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.191.b12-0.el7_5.x86_64 [root@host-10-20-88-228 ~]# rpm -e --nodeps java-1.8.0-openjdk-1.8.0.191.b12-0.el7_5.x86_64
二。安裝less
放在/usr/local/src下執行如下安裝命令:ui
rpm -ivh jdk-8u131-linux-x64.rpm
默認會安裝在/usr/java下code
五、檢查是否安裝it
[root@host-10-20-88-228 soft]# java -version java version "1.8.0_131" Java(TM) SE Runtime Environment (build 1.8.0_131-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
顯示:jvav version"1.8.0_131" ...表示成功io
六、配置環境變量變量
# vi /etc/profile jdk
在最後加入如下幾行:
JAVA_HOME=/usr/java/jdk1.7.0_71
CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASS_PATH PATH
執行下面命令當即生效
source /etc/profile