Skip to content

Instantly share code, notes, and snippets.

@wagyourtail
Last active December 14, 2020 15:30
Show Gist options
  • Save wagyourtail/b115f66d135b3818b63d9b27048d80e6 to your computer and use it in GitHub Desktop.
Save wagyourtail/b115f66d135b3818b63d9b27048d80e6 to your computer and use it in GitHub Desktop.
Installing Java 8 on various Linux distros

Installing Java 8 on various Linux distros

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.

Debian

Oracle

  1. 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.
  2. 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
  3. Extract the tar.gz
    • sudo tar zxvf jre-file-name.tar.gz
  4. 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
  5. Check that java's been properly installed
    • java -version

OpenJDK

  1. Install the pre-requisites
    • sudo apt update
    • sudo apt install apt-transport-https ca-certificates wget dirmngr gnupg software-properties-common
  2. 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 -
  3. Add AdoptOpenJDK's repository.
    • sudo add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
  4. Install openjdk 8
    • sudo apt update
    • sudo apt install adoptopenjdk-8-hotspot
  5. Check that java's been properly installed
    • java -version

Ubuntu

Oracle

see the Debian instructions.

OpenJDK

It's still in the official repos

  • sudo apt install openjdk-8-jre

Arch

Oracle

  • This package is available on the AUR, you can install it using an AUR helper as jre8
  1. Clone the repo
    • git clone https://aur.archlinux.org/jre8.git
    • cd jre8
  2. Build and install the package.
    • makepkg -si

OpenJDK

  • This package is available via pacman
    • sudo pacman -S jre8-openjdk

Manjaro

CentOs / RedHat

Oracle

  1. 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.
  2. install the rpm package
    • sudo rpm –i jre-file-name.rpm

OpenJDK

  • this package is available via yum
    • sudo yum install java-1.8.0-openjdk

Fedora

Oracle

see the CentOs / Redhat instructions.

OpenJDK

  • this package is available via dnf
    • sudo dnf install java-1.8.0-openjdk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment