As of now, 30 April 2019 02:00 UTC, Open JDK 8 and its associated packages have been added back to the normal Ubuntu 19.04 Disco Dingo repositories.
So you can now do the usual
sudo apt install openjdk-8-jdk
without adding any PPAs or downloading .deb packages.
As an aside, I believe the package was removed from 19.04 (while originally being there) because it was (erroneously?) removed from Debian testing (related bug report) and then cleaned up downstream. It has been re-added today by its maintainer Matthias Klose aka doko.
Answer from Andrew on askubuntu.comjava - How to install jdk 8 on ubuntu server 18.04? - Stack Overflow
How can I install Java 8 on Debian 12 (bookworm)? - Unix & Linux Stack Exchange
java - How to install openjdk-8-jdk on Debian 10 (Buster)? - Stack Overflow
java - Install JDK 8 on Debian - Unix & Linux Stack Exchange
Videos
As of now, 30 April 2019 02:00 UTC, Open JDK 8 and its associated packages have been added back to the normal Ubuntu 19.04 Disco Dingo repositories.
So you can now do the usual
sudo apt install openjdk-8-jdk
without adding any PPAs or downloading .deb packages.
As an aside, I believe the package was removed from 19.04 (while originally being there) because it was (erroneously?) removed from Debian testing (related bug report) and then cleaned up downstream. It has been re-added today by its maintainer Matthias Klose aka doko.
While PPA is the preferred method to install JDK 8 in order to get timely updates and fixes, but if you still want to install without PPA, you can download and install JDK 8 from Ubuntu's pool of Universe packages.
Download JDK and JRE:
wget http://security.ubuntu.com/ubuntu/pool/universe/o/openjdk-8/openjdk-8-jdk-headless_8u191-b12-2ubuntu0.18.10.1_amd64.deb wget http://security.ubuntu.com/ubuntu/pool/universe/o/openjdk-8/openjdk-8-jdk_8u191-b12-2ubuntu0.18.10.1_amd64.deb wget http://security.ubuntu.com/ubuntu/pool/universe/o/openjdk-8/openjdk-8-jre_8u191-b12-2ubuntu0.18.10.1_amd64.deb wget http://security.ubuntu.com/ubuntu/pool/universe/o/openjdk-8/openjdk-8-jre-headless_8u191-b12-2ubuntu0.18.10.1_amd64.debInstall using dpkg:
sudo dpkg -i openjdk-8-jre-headless_8u191-b12-2ubuntu0.18.10.1_amd64.deb \ openjdk-8-jre_8u191-b12-2ubuntu0.18.10.1_amd64.deb \ openjdk-8-jdk_8u191-b12-2ubuntu0.18.10.1_amd64.deb \ openjdk-8-jdk-headless_8u191-b12-2ubuntu0.18.10.1_amd64.debInstall dependencies:
sudo apt install -f
If you want to install using PPA, add openjdk-r ppa and install:
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt update
sudo apt install openjdk-8-jdk openjdk-8-jre
Editors note: This answer is outdated as the PPA’s listed are not available anymore.
You can do this for;
Final Update
JDK
sudo apt-get install openjdk-8-jdk
JRE
sudo apt-get install openjdk-8-jre
Old Update
I found two repository but I do not recommend
OpenJDK builds (all archs)
ppa:openjdk-r/ppaOpenJDK 8 backport for trusty
ppa:jochenkemnade/openjdk-8
Original Message
If you really want to use OpenJDK, you have to compile from source. There is not still any PPA for OpenJDK.
It has been requested at https://bugs.launchpad.net/ubuntu/+bug/1297065
I recommend you to use Webup8 Oracle Java8 Installer
Note: WebUpd8 team's PPA has been discontinued with effective from April 16, 2019. Thus this PPA doesn't have any Java files. More information can be found on PPA's page on Launchpad. Hence the below method no longer works and exists because of historical reasons.
sudo add-apt-repository ppa:webupd8team/java -y
sudo apt-get update
sudo apt-get install oracle-java8-installer
To automatically set up the Java 8 environment variables
sudo apt-get install oracle-java8-set-default
Check it
java -version
So you have to wait to use OpenJDK8
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jdk
sudo update-alternatives --config java
sudo update-alternatives --config javac
Thorsten Glaser, the current maintainer of OpenJDK 8 in Debian, provides a repository which includes OpenJDK 8, built using the Debian OpenJDK 8 package (see also Debian bug #989736).
To install it on Debian 12, download the appropriate repository configuration file:
wget http://www.mirbsd.org/~tg/Debs/sources.txt/wtf-bookworm.sources
sudo mkdir -p /etc/apt/sources.list.d
sudo mv wtf-bookworm.sources /etc/apt/sources.list.d/
sudo apt update
You’ll then see openjdk-8-jdk, openjdk-8-jre, etc. available for installation as usual:
sudo apt install openjdk-8-jdk
I am using the distrubution offered by adoptium, called temurin-8-jdk
mkdir -p /etc/apt/keyrings
wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | tee /etc/apt/keyrings/adoptium.asc
echo "deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list
apt update
apt install temurin-8-jdk
Optional to switch from an old repository
update-alternatives --config java # choose new java
update-alternatives --config javac # choose new javac
Alternatively, you can use adoptopenjdk repository:
wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -
sudo add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
sudo apt-get update && sudo apt-get install adoptopenjdk-8-hotspot
https://adoptopenjdk.net/installation.html
WARNING: this answer suggest unsupported and dangerous mixing of Debian releases. Follow the advice on your own risk, as it can break the system on upgrades, as explained in http://wiki.debian.org/DontBreakDebian#Don.27t_make_a_FrankenDebian
Package mirror search steps:
In the Search package directories search for openjdk-8-jdk. You can see two results:
- stretch (oldstable) (java): OpenJDK Development Kit (JDK)
- sid (unstable) (java): OpenJDK Development Kit (JDK)
Choose stretch repository
Scroll to the Download openjdk-8-jdk section and choose your architecture. For example amd64
Now you can see mirrors list and instructions how to install the package via apt:
You should be able to use any of the listed mirrors by adding a line to your /etc/apt/sources.list like this:
deb http://security.debian.org/debian-security stretch/updates main
Installation steps:
Install software source manager
apt-get update apt-get install software-properties-commonAdd mirror with openjdk-8-jdk
apt-add-repository 'deb http://security.debian.org/debian-security stretch/updates main' apt-get updateInstall openjdk 8
apt-get install openjdk-8-jdk
Note: You can use steps above to find an official Debian mirror with any other package you want to install
openjdk-8 is available in my default Jessie/stable install - just need to apt-get install it (openjdk-8-jdk and whatever else you want/need that it recommends or depends on)
Of course, it MAY depend on your /etc/apt/sources.list file including the contrib and non-free repositories
/etc/apt/sources.list should look something like
deb http://ftp.us.debian.org/debian/ jessie main contrib non-free
deb http://security.debian.org/ jessie/updates main contrib non-free
deb http://ftp.us.debian.org/debian/ jessie-updates main contrib non-free
deb http://ftp.us.debian.org/debian/ jessie-backports main contrib non-free
The first thing is always see the Debian PTS to have an idea of what options are available to you. For instance, if I go to -
https://tracker.debian.org/pkg/openjdk-8
On the left-hand side you have something called versions - can you see it, it shows -
stable-bpo: 8u121-b13-1~bpo8+1
testing: 8u121-b13-3
unstable: 8u121-b13-4
Now stable-bpo means it is in backports. the backports page describes its function excellently, see https://backports.debian.org/
So you need to add as shared by @Reto as well the backports address to the list of packages that you already have -
deb http://ftp.us.debian.org/debian/ jessie main contrib non-free
deb http://security.debian.org/ jessie/updates main contrib non-free
deb http://ftp.us.debian.org/debian/ jessie-updates main contrib non-free
deb http://ftp.us.debian.org/debian/ jessie-backports main contrib non-free
Now update the index, it should say something like this at the very end -
Reading package lists... Done
Building dependency tree
Reading state information... Done
6 packages can be upgraded. Run 'apt list --upgradable' to see them.
Don't see the number of packages that can be upgraded as that's a function of how many packages I have, how often I update packages etc. If the four lines are similar to above, that means the index updation went without a hitch, no errors.
Once that is done you could simply do -
$ aptitude search openjdk-8
to get a listing of how many different openjdk-8 packages are listed or not. For instance I'm on testing and there are quite a few here. We also have openjdk-9 as well.
Once you get it , just install as you were trying to install before -
$ sudo aptitude install openjdk-8
and let aptitude handle all the dependancy resolution. If you still have issues, let us know here.
I'm running Debian 9.9 Stretch and am having problems installing OpenJDK 8. I've been Googling stuff for a while but I'm getting nowhere.
Upon entering:
sudo apt-get install openjdk-8-jdk-headless
The output is:
Reading package lists... Done Building dependency tree Reading state information... Done Package openjdk-8-jdk-headless 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 'openjdk-8-jdk-headless' has no installation candidate
I'd appreciate any help or tips on where to look to resolve this.
edit - Problem solved. Finding older versions of OpenJDK on repositories is hard work, if you want one, just download and install it yourself. As for the reason I posted this, the Minecraft server works fine with OpenJDK 11.
The answer over at SO is nicer:
wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -
sudo add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
sudo apt-get update && sudo apt-get install adoptopenjdk-8-hotspot
I've managed to solve it by manually downloading the packages with wget:
RUN wget http://security.debian.org/debian-security/pool/updates/main/o/openjdk-8/openjdk-8-jre-headless_8u212-b03-2~deb9u1_amd64.deb \
&& wget http://security.debian.org/debian-security/pool/updates/main/o/openjdk-8/openjdk-8-jre_8u212-b03-2~deb9u1_amd64.deb \
&& wget http://security.debian.org/debian-security/pool/updates/main/o/openjdk-8/openjdk-8-jdk-headless_8u212-b03-2~deb9u1_amd64.deb \
&& wget http://security.debian.org/debian-security/pool/updates/main/o/openjdk-8/openjdk-8-jdk_8u212-b03-2~deb9u1_amd64.deb
and then install it using the dkpg with the -i --force-all options to install all the required dependencies:
RUN dpkg -i --force-all openjdk-8-jre-headless_8u212-b03-2~deb9u1_amd64.deb openjdk-8-jre_8u212-b03-2~deb9u1_amd64.deb openjdk-8-jdk-headless_8u212-b03-2~deb9u1_amd64.deb openjdk-8-jdk_8u212-b03-2~deb9u1_amd64.deb
You are on Debian 10 (buster), but the link you showed is for Debian 9 (stretch).
OpenJDK is on version 11 for Buster and OpenJDK 8 is not available.
https://packages.debian.org/buster/openjdk-11-jdk
If you need this, use a docker image based on Stretch.
Apparently Debian 10 alias Buster only provides openjdk 11 packages.
In my case this meant using debian 9 alias stretch instead. I must admit it wasn't very clever using latest as a version in the first place.
before:
FROM debian:latest
after:
FROM debian:stretch
Debian stretch is a LTS version supported until 06.2022