How to install JDK8 on Ubuntu 16?

27,400

Solution 1

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.

Solution 2

I installed oracle-jdk8. If you need,

sudo add-apt-repository ppa:webupd8team/java && sudo apt update
sudo apt install oracle-java8-installer

Share:
27,400

Related videos on Youtube

Old Geezer
Author by

Old Geezer

Don't shoot the messenger. An expert, or teacher, is a person who, after reading your question, knows what you know, what you don't know, what you are trying to know, and what else you need to know in order to achieve what you are trying to know.

Updated on September 18, 2022

Comments

  • Old Geezer
    Old Geezer over 1 year

    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:

    /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
    /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java
    

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

    How do I get JDK 8?

  • Old Geezer
    Old Geezer almost 7 years
    I did this but I got E: Unable to locate package openjdk-8-jdk.
  • Pilot6
    Pilot6 almost 7 years
    Run sudo apt update first. You need to be connected to the internet.