Ubuntu – How to install JDK8 on Ubuntu 16

javajdkopenjdksoftware installation

I needed JDK 8 for Bazel. I ran sudo apt-get install openjdk-8* on a freshly built Ubuntu 16.04.02 machine, but after installation update-alternatives --config java show two paths:


I purged opensdk-8* and then installed apt-get openjdk-9* but the outcome was the same.

How do I get JDK 8?

Best Answer

  • Usually you install the openjdk like this:

    sudo apt-get install openjdk-8-jdk

    Maybe this is the problem. You can look this up at http://openjdk.java.net/install/index.html. If you do this you might have fixed this problem. But cant imagine why your command give this result.