安裝Oracle JDK 7.0與8.0 for Mac OS X後Eclipse啟動報錯的解決之道

來源:互聯網
上載者:User

標籤:jdk   eclipse   mac   64位   jvm   

啟動 Eclipse 時,直接報錯 
The JVM shared library "/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/bin/../jre/lib/server/libjvm.dylib" 
does not contain the JNI_CreateJavaVM symbol. 

Unable to find any JVMs matching architecture "i386". 
eclipse[526:14077] Error loading /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/MacOS/libjli.dylib:  dlopen(/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/MacOS/libjli.dylib, 265): no suitable image found.  Did find: 
        /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/MacOS/libjli.dylib: mach-o, but wrong architecture 

既然報 wrong architecture 錯,就看看這兩個檔案到底是什麼狀況: 

通過執行 lipo -info /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/bin/../jre/lib/server/libjvm.dylib 
Architectures in the fat file: /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/bin/../jre/lib/server/libjvm.dylib are: x86_64 

以及 lipo -info /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/MacOS/libjli.dylib 
Non-fat file: /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/MacOS/libjli.dylib is architecture: x86_64 

清楚地顯示 architecture: x86_64,於是乎,真正的根源找到了,是因為Eclipse是32位的,而Oracle JDK 7.0與8.0均為64位的,解決的問題很簡單,下載Eclipse 64位For Mac OS X即可。 
因為 /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/bin/java -d32 -version 執行的結果為: 
Error: This Java instance does not support a 32-bit JVM. 
Please install the desired version. 

參考 https://bugs.eclipse.org/bugs/show_bug.cgi?id=411361 之類的解決方案均是徒勞無功的,換 64 位元版本的 Eclipse 才是正道。


http://www.java2class.net/bbs/viewthread.php?tid=258

安裝Oracle JDK 7.0與8.0 for Mac OS X後Eclipse啟動報錯的解決之道

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.