安装Oracle JDK 7.0与8.0 for Mac OS X后Eclipse启动报错解

安装Oracle JDK 7.0与8.0 for Mac OS X后启动 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 才是正道

Linux下Eclipse CDT + GCC 安装

Debian-7.6下Eclipse-4.4崩溃问题解决

Win7环境下Eclipse连接Hadoop报错简单解决:重编译FileUtil.java 

如何在Ubuntu 14.04中安装最新版Eclipse

Python集成开发环境(Eclipse+Pydev)

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/17379.html