您的位置:首页 > 编程语言 > Java开发

从JDK 6升级到JDK 7过程中遇到的一个问题(卸载rpm)

2016-06-09 22:16 513 查看
先前系统上有JDK 6的安装,由于要部署Facebook的Presto做一些测试,需要将其升级到JDK 7,但是在安装的过程中遇到以下的问题:

[plain] view
plain copy

 





[root@x01 data2]# rpm -ivh --force --replacepkgs jdk-7u45-linux-x64.rpm            

Preparing...                ########################################### [100%]  

   1:jdk                    ########################################### [100%]  

Unpacking JAR files...  

        rt.jar...  

Error: Could not open input file: /usr/java/jdk1.7.0_45/jre/lib/rt.pack  

Error: unpack could not create JAR file:  

  

        /usr/java/jdk1.7.0_45/jre/lib/rt.jar  

  

Please refer to the Troubleshooting section of the Installation Instructions  

on the download page.  

        jsse.jar...  

Error: Could not open input file: /usr/java/jdk1.7.0_45/jre/lib/jsse.pack  

Error: unpack could not create JAR file:  

  

        /usr/java/jdk1.7.0_45/jre/lib/jsse.jar  

  

Please refer to the Troubleshooting section of the Installation Instructions  

on the download page.  

        charsets.jar...  

Error: Could not open input file: /usr/java/jdk1.7.0_45/jre/lib/charsets.pack  

Error: unpack could not create JAR file:  

  

        /usr/java/jdk1.7.0_45/jre/lib/charsets.jar  

  

Please refer to the Troubleshooting section of the Installation Instructions  

on the download page.  

        tools.jar...  

Error: Could not open input file: /usr/java/jdk1.7.0_45/lib/tools.pack  

Error: unpack could not create JAR file:  

  

        /usr/java/jdk1.7.0_45/lib/tools.jar  

  

Please refer to the Troubleshooting section of the Installation Instructions  

on the download page.  

        localedata.jar...  

Error: Could not open input file: /usr/java/jdk1.7.0_45/jre/lib/ext/localedata.pack  

Error: unpack could not create JAR file:  

  

        /usr/java/jdk1.7.0_45/jre/lib/ext/localedata.jar  

  

Please refer to the Troubleshooting section of the Installation Instructions  

on the download page.  

        jfxrt.jar...  

Error: Could not open input file: /usr/java/jdk1.7.0_45/jre/lib/jfxrt.pack  

Error: unpack could not create JAR file:  

  

        /usr/java/jdk1.7.0_45/jre/lib/jfxrt.jar  

  

Please refer to the Troubleshooting section of the Installation Instructions  

on the download page.  

如果在这种情况下,我们查看Java的版本,会报出以下的错误:

[plain] view
plain copy

 





[root@x01 data2]# java -version  

Error occurred during initialization of VM  

java/lang/NoClassDefFoundError: java/lang/Object  

最终的解决办法,是清理掉系统残留的旧版本的相关的安装:

[plain] view
plain copy

 





[root@x01 data2]# rpm -qa | grep jdk  

jdk-1.7.0_45-fcs.x86_64  

[root@x01 data2]# rpm -e jdk-1.7.0_45-fcs.x86_64  

[root@x01 data2]# rpm -qa | grep jdk  

[root@x01 data2]# rpm -qa | grep java  

sun-javadb-core-10.6.2-1.1.i386  

sun-javadb-javadoc-10.6.2-1.1.i386  

sun-javadb-common-10.6.2-1.1.i386  

sun-javadb-client-10.6.2-1.1.i386  

sun-javadb-docs-10.6.2-1.1.i386  

sun-javadb-demo-10.6.2-1.1.i386  

[root@x01 data2]# rpm -e sun-javadb-*  

error: package sun-javadb-* is not installed  

[root@x01 data2]# rpm -e sun-javadb-core-10.6.2-1.1.i386  sun-javadb-javadoc-10.6.2-1.1.i386 sun-javadb-common-10.6.2-1.1.i386 sun-javadb-client-10.6.2-1.1.i386 sun-javadb-docs-10.6.2-1.1.i386 sun-javadb-demo-10.6.2-1.1.i386  

[root@x01 data2]# rpm -qa | grep java  

[root@x01 data2]# rpm -qa | grep jre  

[root@x01 data2]# rpm -qa | grep java  

[root@x01 data2]# rpm -qa | grep jdk  

这样之后,再运行先前的安装程序即可:

[plain] view
plain copy

 





[root@x01 data2]# rpm -ivh  jdk-7u45-linux-x64.rpm                        

Preparing...                ########################################### [100%]  

   1:jdk                    ########################################### [100%]  

Unpacking JAR files...  

        rt.jar...  

        jsse.jar...  

        charsets.jar...  

        tools.jar...  

        localedata.jar...  

        jfxrt.jar...  

[root@x01 data2]# source /etc/profile  

[root@x01 data2]# java -version  

java version "1.7.0_45"  

Java(TM) SE Runtime Environment (build 1.7.0_45-b18)  

Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)  

[root@x01 data2]#   
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  数据 api shell