MAC environment installation Eclipse 2020-03 report “failed to create the Java virtual machine” error resolution
in macOS Catalina 10.15.2 environment, install the latest version of Eclipse: eclipse-je-2020-03-r-gesty-macosx-cocoa-x86_64. DMG, and run Eclipse report “failed to create the Java virtual machine” after installation.
as shown in figure 1:
the problem is due to JDK 14 being installed in the macOS environment. Even with the latest version of Eclipse, JDK 14 is still not supported, up to JDK 13, so the solution is to uninstall JDK 14. If you want to keep JDK 14 and Eclipse 2020-03 coexisting, you can solve this:
step 1: execute the command under the Shell terminal:
$ /usr/libexec/java_home -V
Matching Java Virtual Machines (3):
14, x86_64: "Java SE 14" /Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/Home
11.0.3, x86_64: "AdoptOpenJDK 11" /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
1.8.0_232, x86_64: "AdoptOpenJDK 8" /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
as you can see, I have JDK 8, 11, and 14 on my host.
note , executing “/usr/libexec/ java_home-v 11” is invalid, it will not resolve the error of Eclipse.
step 2: use the editor open Eclipse app/Contents/Resources/Info. The file, found at the back of the label, and modify the content is as follows: </ p>
<array>
<string>-vm</string>
<string>/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin</string>
<string>-keyring</string>
<string>~/.eclipse_keyring</string>
</array>
as shown in figure 2:
save and exit.
note that you add the -vm option and point the vm option to JDK 11 (you can also point to JDK 8 or any version that is not native to JDK14, depending on your needs).
restart Eclipse and the familiar interface returns. Figure 3: