Can't install Eclipse - "Failed to create the Java Virtual Machine" on Mac

Edit the file /Applications/Eclipse.app/Contents/Info.plist

There is a comment for use a particular JVM:

<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>/Library/Java/JavaVirtualMachines/jdk8u192-b12/Contents/Home/jre/</string>
    <string>-keyring</string>
    <string>~/.eclipse_keyring</string>
</array>

It took me some time to figure this out as well. The main takeaway was eclipse does not support SDK Version 14 (as of eclipse 2020-03). That was not completely obvious to me.

  1. Install a supported version (I used Homebrew to install SDK V8 ):

    brew cask install adoptopenjdk/openjdk/adoptopenjdk8
    

    If this is the only Java Version you have installed you should be fine and Eclipse should open up. If that is not the case and you have another Java Version installed. You have to tell Eclipse which Version of Java it should be using (see Step 2).

  2. Tell Eclipse which Version to use by editing the /Applications/Eclipse.app/Contents/Info.plist file as described by Juan Ignacio Barisich and Brad Parks. That being the version you installed in step 1.

    nano /Applications/Eclipse.app/Contents/Info.plist
    # or
    open /Applications/Eclipse.app/Contents/Info.plist
    
    <key>Eclipse</key>
    <array>
        <string>-keyring</string>
        <string>~/.eclipse_keyring</string>
        <string>-vm</string>
        <string>/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/</string>
    </array>
    

Disclaimer: Please bare in mind that those were the steps I took to get eclipse running again. Because I'm nowhere qualified to give a precise answer about this please take a look at the comments in case I got something wrong.

Edit: See Christian Fries answer who pointed out that all java versions 8 to 13 are supported by eclipse.


For me, I had to edit the eclipse-inst.ini file located here:

Eclipse Installer.app/Contents/Eclipse/eclipse-inst.ini

and add the path to my local java VM, which is here:

-vm
/Users/bparks/jdk/jdk1.8.0_162_x64/bin/java

If the Eclipse Installer.app file is in a DMG, right click on it, and copy it, then paste it into another folder. Then right click on that app file, and choose "Show Package Contents", to get into the files inside the application.

If you've already got Eclipse installed, and find it's throwing the same error, you could try a similar approach by editing the following file for Eclipse:

/Applications/Eclipse.app/Contents/Eclipse/eclipse.ini

On mac, you can get the full path you'd need to your java exe by running the following in a terminal, which will copy the path to your clipboard.

$ echo $(/usr/libexec/java_home)/bin/java | pbcopy

Tags:

Java

Eclipse