安装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 安装 http://www.linuxidc.com/Linux/2014-10/107625.htm
Debian-7.6下Eclipse-4.4崩溃问题解决 http://www.linuxidc.com/Linux/2014-09/106752.htm
Win7环境下Eclipse连接Hadoop报错简单解决:重编译FileUtil.java http://www.linuxidc.com/Linux/2014-09/106647.htm
如何在Ubuntu 14.04中安装最新版Eclipse http://www.linuxidc.com/Linux/2014-08/105090.htm
Python集成开发环境(Eclipse+Pydev) http://www.linuxidc.com/Linux/2014-08/105052.htm
本文永久更新链接地址:http://www.linuxidc.com/Linux/2014-10/108205.htm