Mac启动Eclipse提示Failed to create the Java Virtual Machine

Mac启动Eclipse提示Failed to create the Java Virtual Machine

Mac系统升级到Big Sur之后,Eclipse提示Failed to create the Java Virtual Machine

Mac系统版本
启动Eclipse报错!!!

解决方法

出现这种情况,可以通过指定Java路径方式进行解决;

  1. 首先需要找到Eclipse.app的info.plist文件:/Application/Eclipse.app/Contents/info.plsit
    通过文本编辑工具打开之后可以找到如下内容:

在这里插入图片描述

注意:找到注释部分,复制最后一行,指定VM,记得更改成自己的JDK版本

原始info.plsit

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<plist version="1.0">

<dict>
	<key>CFBundleExecutable</key>
		<string>eclipse</string>
	<key>CFBundleGetInfoString</key>
		<string>Eclipse 4.12 for Mac OS X, Copyright IBM Corp. and others 2002, 2019. All rights reserved.</string>
	<key>CFBundleIconFile</key>
		<string>Eclipse.icns</string>
	<key>CFBundleIdentifier</key>
		<string>org.eclipse.platform.ide</string>
	<key>CFBundleInfoDictionaryVersion</key>
		<string>6.0</string>
	<key>CFBundleName</key>
		<string>Eclipse</string>
	<key>CFBundlePackageType</key>
		<string>APPL</string>
	<key>CFBundleShortVersionString</key>
		<string>4.12.0</string>
	<key>CFBundleSignature</key>
		<string>????</string>
	<key>CFBundleVersion</key>
		<string>4.12.0.I20190605-1800</string>
	<key>NSHighResolutionCapable</key>
		<true/>
	<key>CFBundleDevelopmentRegion</key>
		<string>English</string>		
	<key>Eclipse</key>
		<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>
<key>CFBundleDisplayName</key>
    <string>Eclipse</string>
  </dict>

</plist>

修改后info.plsit

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<plist version="1.0">

<dict>
	<key>CFBundleExecutable</key>
		<string>eclipse</string>
	<key>CFBundleGetInfoString</key>
		<string>Eclipse 4.12 for Mac OS X, Copyright IBM Corp. and others 2002, 2019. All rights reserved.</string>
	<key>CFBundleIconFile</key>
		<string>Eclipse.icns</string>
	<key>CFBundleIdentifier</key>
		<string>org.eclipse.platform.ide</string>
	<key>CFBundleInfoDictionaryVersion</key>
		<string>6.0</string>
	<key>CFBundleName</key>
		<string>Eclipse</string>
	<key>CFBundlePackageType</key>
		<string>APPL</string>
	<key>CFBundleShortVersionString</key>
		<string>4.12.0</string>
	<key>CFBundleSignature</key>
		<string>????</string>
	<key>CFBundleVersion</key>
		<string>4.12.0.I20190605-1800</string>
	<key>NSHighResolutionCapable</key>
		<true/>
	<key>CFBundleDevelopmentRegion</key>
		<string>English</string>		
	<key>Eclipse</key>
		<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_281.jdk/Contents/Home/bin/java</string>
			<string>-keyring</string>
      <string>~/.eclipse_keyring</string>
		</array>
<key>CFBundleDisplayName</key>
    <string>Eclipse</string>
  </dict>

</plist>

运行Eclipse可以正常启动

已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页