1.解决办法:
64-bit Eclipse requires a 64-bit JVM, and 32-bit Eclipse requires 32-bit JVM--you can not mix-and-match
between 32-bit and 64-bit.
2.问题:
下载了Eclipse4.16,openjdk8,双击安装Eclipse无法启动,报错:
---------------------------
Eclipse
---------------------------
Failed to load the JNI shared library "D:\...\jvm.dll".
---------------------------
确定
---------------------------
3.分析:
经过查阅官网的各种资料,发现64位的Eclipse只支持64位的jdk,32位的只支持32位jdk。
当然,各位会说这不是废话吗?是的,我承认是这样的。不过这往往也是容易忽略的。
尤其遇到了openjdk8这个"异类"。原生的openjdk8,大家都是从https://jdk.java.net/java-se-ri
这个页面下载的吧,估计没有注意到下载的
openjdk-8u43-windows-i586.zip,这个是32位的。
不信可以打开cmd,输入验证:
To check if you have a 32-bit Java Runtime.:
Code: [Select all] [Show/ hide]
java -d32 -version
To check if you have a 64-bit Java Runtime.:Code: [Select all] [Show/ hide]
java -d64 -version
这样,大家就能知道怎么解决了。
4.具体方案:
方案一:使用openjdk9及以上
方案二:若对jdk8情有独钟,可以选择其他家的jdk8,比如Eclipse Temurin或其他的jdk。(太多了厂家,自己选择)
Eclipse Temurin下载地址:Latest Releases | Adoptium(可以选择合适的系统位数和jdk版本)
注意:Eclipse版本兼容的jdk版本:Eclipse/Installation - Eclipsepedia
Eclipse官网推荐的jdk资源:
JRE/JDK Sources
Be sure to install a JVM with the same bit level as Eclipse
i.e. install a 32-bit JRE to run 32-bit Eclipse; install a 64-bit JRE to run 64-bit EclipseThere are several sources for a JRE/JDK. Here are some of the more common/popular ones (listed alphabetically):
- AdoptOpenJDK
- IBM JDK
- OpenJDK
- Oracle JDK