Ubuntu – No Java virtual machine was found when trying to run Eclipse installer

16.04eclipsejavaopenjdk

Trying to install Eclipse on fresh Ubuntu. Got error:

enter image description here

If I type java command I have output:

enter image description here

Can I install default OpenJDK or should I go to Oracle site and download Java there?
Why I can't use OpenJDK?

Best Answer

In Ubuntu 16.04-20.04 open the terminal and type:

sudo apt install openjdk-8-jdk  

enter image description here
Eclipse Preferences in Ubuntu 16.04

After you install openjdk-8-jdk the results of update-java-alternatives -l will look similar to this:

:~$ update-java-alternatives -l  
java-1.8.0-openjdk-amd64       1081       /usr/lib/jvm/java-1.8.0-openjdk-amd64  

If you have installed more than one version of Java there will be multiple lines in the results of update-java-alternatives -l however openjdk-8-jdk will work with everything, so you don't need to install another version of Java.

$ update-java-alternatives
usage: update-java-alternatives [--jre-headless] [--jre] [--plugin] [-v|--verbose]
           -l|--list [<jname>]
           -s|--set <jname>
           -a|--auto
           -h|-?|--help
Related Question