How to fix the Eclipse 'No Java virtual machine was found' install error
<tl;dr>
To fix the Eclipse “No Java virtual machine was found” error, simply edit the eclipse-inst.ini file and add the -vm flag, which points it to the java utility in the JDK bin directory:
-vm/opt/jdk-13/bin/java
</tl;dr>
Nothing saps a developer’s enthusiasm to learn a new language feature or play around with a new Java distribution more than a disconcerting error message during the environment setup. If you’re interested in an Eclipse installation on Ubuntu or Windows, this sort of error message is exactly what happens if your JRE or JDK isn’t found by the installer.
A JRE or JDK must be available
The only prerequisite to install Eclipse is a modern Linux or Windows operating system and a compatible JDK installation, with preference given to Java 8 versions and above. But personally, after I performed a Java 13 JDK install, and properly set JAVA_HOME and PATH variables, I still ran into the dreaded “A JRE or JDK must be available in order to run the Eclipse Installer”1 error. That’s some bad news.
But the good news? There’s a simple fix to the Eclipse “No Java virtual machine was found” error when you install it on Ubuntu.
No Java virtual machine found
The JVM not found problem stems from the fact that by default, the Eclipse installer looks for a JRE or JDK installation in a folder relative to where the installation is run. To override this default behavior, simply add a -vm flag to the eclipse-inst.ini file and point it at the location of the java utility in the JDK install’s \bin folder. For me, the setting looked like this:
-vm /opt/jdk-13/bin/java
And that’s it. Make the change, save the file, and then re-run the Eclipse installer. The Eclipse “No Java virtual machine was found” error will go away, and the Eclipse IDE will be successfully installed on your desktop.
No virtual machine found fix overview
In summary, the steps to fix the Eclipse “No Java Virtual machine was found” error are:
- Edit the eclipse-inst.ini file
- Add the -vm flag
- Point the -vm flag to the JDK\bin\java location
- Save the file
- Re-run the Eclipse installer
Citations
- The full text of the error: A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse Installer. No Java virtual machine was found after searching the following locations: /eclipse-inst-linux64/eclipse-installer/jre/bin/java java in your current path.