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?


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>
| improve this answer | |

the easiet way to install java and java releated packages (eg maven ,kotlin etc) is using sdkman.

step - 1 : Installing SDKMAN! on UNIX-like platforms is as easy as ever. SDKMAN! installs smoothly on Mac OSX, Linux, Cygwin, Solaris and FreeBSD. We also support Bash and ZSH shells. Simply open a new terminal and enter:

$ curl -s "https://get.sdkman.io" | bash

Follow the instructions on-screen to complete installation. Next, open a new terminal or enter:

$ source "$HOME/.sdkman/bin/sdkman-init.sh"

Lastly, run the following code snippet to ensure that installation succeeded:

$ sdk version

If all went well, the version should be displayed. Something like:

sdkman 5.0.0+51

step 2 - sdk ls it will give you all the java releated packages sdk install java will install java on system

step 3 - install ubutu-make for downloading any ide you need Installing Ubuntu Make If you are on the latest Ubuntu version (at the time of writing, it is 16.04, codename Xenial), you can install it directly from the Universe archive:

 $ sudo apt install ubuntu-make

If your Ubuntu version if before 16.04 (codename Xenial), you can install from the Ubuntu Make PPA. First, add the PPA to your system:

 $ sudo add-apt-repository ppa:ubuntu-desktop/ubuntu-make

 $ sudo apt-get update

Then, installing Ubuntu Make:

 $ sudo apt-get install ubuntu-make

step 4 install eclipse from umake

$ umake ide eclipse


| improve this answer | |

you'll need to edit your /etc/environment file:

sudo gedit /etc/environment

then edit the line :


by adding your java's bin path (adapt this to your own, you can find out which dirrectory your's is in with the command whereis java) to the end of the PATH, before the last " like this :


once you've saved it, you may run this in your terminal :

source /etc/environment

this exports the values of that file (the path) to your whole system but for it to really take effect you'll need to reboot or log out and back in.

after this eclipse will start. (although I really believe eclipse as a whole is outdated there are so many better alternatives today : Visual Studio Code, Intellij...)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.