Red Hat5.5安装JAVA(JDK)显示的版本不对

[root@Linux9 jdk1.8]# java -version
java version "1.4.2"
gij (GNU libgcj) version 4.1.2 20080704 (Red Hat 4.1.2-48)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

原因:检查有旧版本的jdk,造成版本冲突

[root@Linux9 jdk1.8]# rpm -qa|grep gcj
java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
libgcj-4.1.2-48.el5

注:centos 中如果版本不对,就用yum 查:

        [root@Linux9 jdk1.8]# yum list|grep jdk

       发现“@”安装的版本用yum remove全卸载掉

卸载旧的版本:

[root@Linux9 jdk1.8]# rpm -e --nodeps java-1.4.2-gcj-compat-1.4.2.0-40jpp.115

[root@Linux9 jdk1.8]# java -version
-bash: /usr/bin/java: 没有那个文件或目录
[root@Linux9 jdk1.8]# . /etc/profile.d/java.sh
[root@Linux9 jdk1.8]# java -version
java version "1.8.0_71"
Java(TM) SE Runtime Environment (build 1.8.0_71-b15)
Java HotSpot(TM) Client VM (build 25.71-b15, mixed mode)

你可能感兴趣的:(java,red,hat5.5)