40

I tried to install java8 using the following commands:

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

I'm getting an error as follows :

Package oracle-java8-installer is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'oracle-java8-installer' has no installation candidate

when I searched the error, I found out that "WebUpd8" team has officially discontinued there support.
Please help to install oracle java 8. I'm using ubuntu 16.04.

5 Answers 5

71

I just went through the same process and I fixed the problem by manually installing java 8 on my ubuntu 18.04 machine. Hopefully my answer will help you.

  1. Download the latest JAVA 8 SE development kit from here: https://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html
  2. Open your terminal.
  3. Type $mkdir /opt/jdk.
  4. Untar Java in your new folder $tar -zxf jdk-8u5-linux-x64.tar.gz -C /opt/jdk.
  5. Set oracle JDK as the default JVM by running those two instructions (or something around that depending on your configuration):

Note: Each bullet point is one single command

  • update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_<YourVersion>/bin/java 100
  • update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_<YourVersion>/bin/javac 100

You can check the result by running java -version !

Before I started, I went through those steps as well in order to remove completely java from my system: https://askubuntu.com/questions/84483/how-to-completely-uninstall-java#185250

The source I used for the manual installation of JAVA was this article: https://www.digitalocean.com/community/tutorials/how-to-manually-install-oracle-java-on-a-debian-or-ubuntu-vps

Sign up to request clarification or add additional context in comments.

8 Comments

I think it would be easier to do a sudo update-alternatives --config java and then just choose the alternative for java 8
Thanks to this wonderful post! It saves my life configuring Elasticsearch in Ubuntu 18.04. Thanks for sharing!
No problem! Glad I could help
This is giving me a -bash: /usr/bin/java: No such file or directory error.
just to be more precise the syntax is : sudo update-alternatives --install "/usr/bin/java" "java" "yourinstallpath" 1 with the double quotes
|
32

Add the following line to /etc/apt/sources.list:

deb https://debian.opennms.org/ stable main

Install GPG key of the repository:

wget -O - http://debian.opennms.org/OPENNMS-GPG-KEY | sudo apt-key add -

Update the package index:

sudo apt-get update

Install oracle-java8-installer deb package:

sudo apt-get install oracle-java8-installer

Source

Comments

13

I was facing the same issue and resolved with this:\

sudo apt install openjdk-8-jdk

Comments

8

Please read the details when we execute the below command: sudo add-apt-repository ppa:webupd8team/java

The Oracle JDK License has changed for releases starting April 16, 2019.

The new Oracle Technology Network License Agreement for Oracle Java SE is substantially different from prior Oracle JDK licenses. The new license permits certain uses, such as personal use and development use, at no cost -- but other uses authorized under prior Oracle JDK licenses may no longer be available. Please review the terms carefully before downloading and using this product. An FAQ is available here: https://www.oracle.com/technetwork/java/javase/overview/oracle-jdk-faqs.html

Oracle Java downloads now require logging in to an Oracle account to download Java updates, like the latest Oracle Java 8u211 / Java SE 8u212. Because of this I cannot update the PPA with the latest Java (and the old links were broken by Oracle).

For this reason, THIS PPA IS DISCONTINUED (unless I find some way around this limitation).

Comments

5

This PPA works (Ubuntu 16.04)

sudo add-apt-repository ppa:ts.sch.gr/ppa
sudo apt-get update
sudo apt-get install oracle-java8-installer

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.