rpm -qa | grep java rpm -qa | grep gcj rpm -qa | grep jdk rpm -e --nodeps java-1.6.0-openjdk-1.6.0.0-1.66.1.13.0.el6.x86_64 rpm -e --nodeps tzdata-java-2013g-1.el6.noarch rpm -e --nodeps java-1.5.0-gcj-1.5.0.0-29.1.el6.x86_64 rpm -e --nodeps java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.x86_64 rpm -e --nodeps java_cup-0.10k-5.el6.x86_64 rpm -e --nodeps libgcj-4.4.7-4.el6.x86_64
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.htmlhtml
rpm -ivh jdk-8u171-linux-x64.rpm cd /usr/java/ ll
打開 vim /etc/profile
,在末尾添加java
export JAVA_HOME=/usr/java/default export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export PATH=$PATH:$JAVA_HOME/bin
source /etc/profile
使用 java -version
查看如今的Java版本號。node
java version "1.8.0_171" Java(TM) SE Runtime Environment (build 1.8.0_171-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)