生活随笔
收集整理的這篇文章主要介紹了
从JDK 6升级到JDK 7过程中遇到的一个问题(卸载rpm)
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
先前系統(tǒng)上有JDK 6的安裝,由于要部署Facebook的Presto做一些測試,需要將其升級到JDK 7,但是在安裝的過程中遇到以下的問題:
[plain]?view plaincopy
[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 plaincopy
[root@x01?data2]#?java?-version?? Error?occurred?during?initialization?of?VM?? java/lang/NoClassDefFoundError:?java/lang/Object??
最終的解決辦法,是清理掉系統(tǒng)殘留的舊版本的相關的安裝:
[plain]?view plaincopy
[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 plaincopy
[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]# ??
總結
以上是生活随笔為你收集整理的从JDK 6升级到JDK 7过程中遇到的一个问题(卸载rpm)的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網(wǎng)站內容還不錯,歡迎將生活随笔推薦給好友。