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

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


[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. [root@x01 data2]# rpm -ivh --force --replacepkgs jdk-7u45-linux-x64.rpm            
  2. Preparing...                ########################################### [100%]  
  3.    1:jdk                    ########################################### [100%]  
  4. Unpacking JAR files...  
  5.         rt.jar...  
  6. Error: Could not open input file: /usr/java/jdk1.7.0_45/jre/lib/rt.pack  
  7. Error: unpack could not create JAR file:  
  8.   
  9.         /usr/java/jdk1.7.0_45/jre/lib/rt.jar  
  10.   
  11. Please refer to the Troubleshooting section of the Installation Instructions  
  12. on the download page.  
  13.         jsse.jar...  
  14. Error: Could not open input file: /usr/java/jdk1.7.0_45/jre/lib/jsse.pack  
  15. Error: unpack could not create JAR file:  
  16.   
  17.         /usr/java/jdk1.7.0_45/jre/lib/jsse.jar  
  18.   
  19. Please refer to the Troubleshooting section of the Installation Instructions  
  20. on the download page.  
  21.         charsets.jar...  
  22. Error: Could not open input file: /usr/java/jdk1.7.0_45/jre/lib/charsets.pack  
  23. Error: unpack could not create JAR file:  
  24.   
  25.         /usr/java/jdk1.7.0_45/jre/lib/charsets.jar  
  26.   
  27. Please refer to the Troubleshooting section of the Installation Instructions  
  28. on the download page.  
  29.         tools.jar...  
  30. Error: Could not open input file: /usr/java/jdk1.7.0_45/lib/tools.pack  
  31. Error: unpack could not create JAR file:  
  32.   
  33.         /usr/java/jdk1.7.0_45/lib/tools.jar  
  34.   
  35. Please refer to the Troubleshooting section of the Installation Instructions  
  36. on the download page.  
  37.         localedata.jar...  
  38. Error: Could not open input file: /usr/java/jdk1.7.0_45/jre/lib/ext/localedata.pack  
  39. Error: unpack could not create JAR file:  
  40.   
  41.         /usr/java/jdk1.7.0_45/jre/lib/ext/localedata.jar  
  42.   
  43. Please refer to the Troubleshooting section of the Installation Instructions  
  44. on the download page.  
  45.         jfxrt.jar...  
  46. Error: Could not open input file: /usr/java/jdk1.7.0_45/jre/lib/jfxrt.pack  
  47. Error: unpack could not create JAR file:  
  48.   
  49.         /usr/java/jdk1.7.0_45/jre/lib/jfxrt.jar  
  50.   
  51. Please refer to the Troubleshooting section of the Installation Instructions  
  52. on the download page.  

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

[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. [root@x01 data2]# java -version  
  2. Error occurred during initialization of VM  
  3. java/lang/NoClassDefFoundError: java/lang/Object  

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

[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. [root@x01 data2]# rpm -qa | grep jdk  
  2. jdk-1.7.0_45-fcs.x86_64  
  3. [root@x01 data2]# rpm -e jdk-1.7.0_45-fcs.x86_64  
  4. [root@x01 data2]# rpm -qa | grep jdk  
  5. [root@x01 data2]# rpm -qa | grep java  
  6. sun-javadb-core-10.6.2-1.1.i386  
  7. sun-javadb-javadoc-10.6.2-1.1.i386  
  8. sun-javadb-common-10.6.2-1.1.i386  
  9. sun-javadb-client-10.6.2-1.1.i386  
  10. sun-javadb-docs-10.6.2-1.1.i386  
  11. sun-javadb-demo-10.6.2-1.1.i386  
  12. [root@x01 data2]# rpm -e sun-javadb-*  
  13. error: package sun-javadb-* is not installed  
  14. [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  
  15. [root@x01 data2]# rpm -qa | grep java  
  16. [root@x01 data2]# rpm -qa | grep jre  
  17. [root@x01 data2]# rpm -qa | grep java  
  18. [root@x01 data2]# rpm -qa | grep jdk  

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

[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. [root@x01 data2]# rpm -ivh  jdk-7u45-linux-x64.rpm                        
  2. Preparing...                ########################################### [100%]  
  3.    1:jdk                    ########################################### [100%]  
  4. Unpacking JAR files...  
  5.         rt.jar...  
  6.         jsse.jar...  
  7.         charsets.jar...  
  8.         tools.jar...  
  9.         localedata.jar...  
  10.         jfxrt.jar...  
  11. [root@x01 data2]# source /etc/profile  
  12. [root@x01 data2]# java -version  
  13. java version "1.7.0_45"  
  14. Java(TM) SE Runtime Environment (build 1.7.0_45-b18)  
  15. Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)  
  16. [root@x01 data2]#   
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值