3

As you can see in the screenshot, i was told to apt-get install oracle-java8-install but it gave me an error that I don't have met dependencies of java-common. Okay, great. Now I try to install apt-get install java-common. Another error! Now I'm totally lost.

Ubuntu is at version 18.04, after so many years why is it still such a PITA to install simple stuff like this.

I am going to cry.

enter image description here

Patoshi パトシ
  • 2,993
  • 15
  • 32
  • 44
  • It looks like you're following an obsolete tutorial. Does it have to oracle jdk? Ubuntu has openjdk packages in the repository. For jdk 8 the package name is openjdk-8-jdk. Btw, openjdk is the reference implementation of java. Also there is default-jdk meta-package but I'm not sure what version of jdk it will pull, in 16.04 it's jdk 8. – aasril Sep 27 '18 at 07:01
  • I tried sudo apt install openjdk-8-jdk i get dependency error: oracle-java8-installer : Depends: java-common but it is not installable -- I then do a apt install java-common which throws error: Unable to locate package oracle-java-common – Patoshi パトシ Oct 01 '18 at 15:51
  • You need to fix/remove the broken package first. This is entirely a different problem. You can search the solution on this website or google. – aasril Oct 02 '18 at 05:57

2 Answers2

2

Why is it such a PITA? The Oracle version of Java is not able to be distributed the same way as other Ubuntu packages. The best solution to this is to use the openJDK version of Java.

If you absolutely need to use Oracle Java 8, you'll need to add a PPA to your repository list:

$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt update

And then install Oracle Java 8 (I'm assuming you also want it to be set as default)

$ sudo apt install oracle-java8-set-default

This should begin the installation, and you should get a prompt asking to accept the license. Use the keyboard to accept it, and it should begin downloading Oracle Java 8. You should see a progress indicator that scrolls up your screen.

It should install Oracle Java 8 update 181.

  • Doesn't work! I get hit with dependency errors again: says to install oracle-java8-installer and then that fails and ask for oracle-java-common which also fails too! "unable to locate package oracle-java-common' – Patoshi パトシ Oct 01 '18 at 15:49
  • Does not work. since this ppa was disabled – Tobbey Apr 29 '19 at 12:58
  • I think the PPA is still around, but it may only support up to Ubuntu 18.10. https://launchpad.net/~webupd8team/+archive/ubuntu/java – emptythevoid May 09 '19 at 12:28
0

My sources were all messed up it seems. Everything was commented out in this file: /etc/apt/sources.list

I pasted the following into it instead:

#------------------------------------------------------------------------------#
#                            OFFICIAL UBUNTU REPOS                             #
#------------------------------------------------------------------------------#


###### Ubuntu Main Repos
deb http://us.archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse 

###### Ubuntu Update Repos
deb http://us.archive.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse 
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse 
deb http://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse 
Patoshi パトシ
  • 2,993
  • 15
  • 32
  • 44