This guide will show you how to install both the openjdk and oracle java distros on linux via the command line, the steps are practically identical for the JDK, but have a different download links / package names.
- Download the jre tar.gz (Linux Compressed Archive) from Oracle's Website or the Java Website.
- make sure to select the correct x86 / x64 for your Architecture, it's probably x64 if your computer's newer than 2005.
- Create the folder to install to and move the tar there.
sudo mkdir /usr/local/java
sudo mv jre-file-name.tar.gz /usr/local/java
- Extract the tar.gz
sudo tar zxvf jre-file-name.tar.gz
- Tell Debian you installed java, (this command assumes
v151
, check what jre folder is actually created)sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jre1.8.0_151/bin/java" 1
- Check that java's been properly installed
java -version
- Install the pre-requisites
sudo apt update
sudo apt install apt-transport-https ca-certificates wget dirmngr gnupg software-properties-common
- Add AdoptOpenJDK's gpg key.
- this allows AdoptOpenJDK's software to be installed.
wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -
- Add AdoptOpenJDK's repository.
sudo add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
- Install openjdk 8
sudo apt update
sudo apt install adoptopenjdk-8-hotspot
- Check that java's been properly installed
java -version
see the Debian instructions.
It's still in the official repos
sudo apt install openjdk-8-jre
- This package is available on the AUR, you can install it using an AUR helper as
jre8
- Clone the repo
git clone https://aur.archlinux.org/jre8.git
cd jre8
- Build and install the package.
makepkg -si
- This package is available via pacman
sudo pacman -S jre8-openjdk
- see Arch
- Download the jre RPM from Oracle's Website or the Java Website.
- make sure to select the correct x86 / x64 for your Architecture, it's probably x64 if your computer's newer than 2005.
- install the rpm package
sudo rpm –i jre-file-name.rpm
- this package is available via yum
sudo yum install java-1.8.0-openjdk
see the CentOs / Redhat instructions.
- this package is available via dnf
sudo dnf install java-1.8.0-openjdk