在升级了Mac到最新版本后,启动Eclipse提示如下错误:
Failed to create the Java Virtual Machine
启动错误图片:
启动错误提示
出现这个错误的解决办法是修改Eclipse的Java JDK路径。找到Eclipse的info.plist文件:/Application/Eclipse.app/Contents/info.plist。通过文本编辑工具打开之后找到如下内容:
<array>
<!-- to use a specific Java version (instead of the platform's default) uncomment one of the following options,
or add a VM found via $/usr/libexec/java_home -V
<string>-vm</string><string>/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Commands/java</string>
<string>-vm</string><string>/Library/Java/JavaVirtualMachines/1.8.0.jdk/Contents/Home/bin/java</string>
-->
<string>-keyring</string>
<string>~/.eclipse_keyring</string>
</array>
在配置文件中增加一行配置JDK路径
<array>
<!-- to use a specific Java version (instead of the platform's default) uncomment one of the following options,
or add a VM found via $/usr/libexec/java_home -V
<string>-vm</string><string>/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Commands/java</string>
<string>-vm</string><string>/Library/Java/JavaVirtualMachines/1.8.0.jdk/Contents/Home/bin/java</string>
-->
<string>-vm</string><string>/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/java</string>
<string>-keyring</string>
<string>~/.eclipse_keyring</string>
</array>
增加完配置后,再次启动Eclipse可以正常启动。
另附查看jdk按照路径命令
echo $JAVA_HOME
在本地终端中执行:echo $JAVA_HOME
网友评论