🌐
GitHub
gist.github.com › wagyourtail › b115f66d135b3818b63d9b27048d80e6
Installing Java 8 on various Linux distros - Gist - GitHub
... 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
🌐
Oracle
java.com › en › download › help › linux_x64_install.html
Linux 64-bit installation instructions for Java
The instructions below are for installing version Java 8 Update 73 (8u73). If you are installing another version, make sure you change the version number appropriately when you type the commands at the terminal. Example: For Java 8u79 replace 8u73 with 8u79.
🌐
Oracle
java.com › en › download › help › linux_install.html
How do I download and install 32-bit Java for Linux?
Install the package. rpm -ivh jre-8u73-linux-i586.rpm To upgrade a package, rpm -Uvh jre-8u73-linux-i586.rpm
🌐
Oracle
java.com › en › download › help › linux_x64rpm_install.html
Linux 64-bit RPM Java installation instructions
Install the package. rpm -ivh jre-8u73-linux-x64.rpm To upgrade a package: rpm -Uvh jre-8u73-linux-x64.rpm
🌐
Javaspring
javaspring.net › blog › run-java-8-linux-cmd
Running Java 8 on Linux via Command Line | JavaSpring.net
July 5, 2025 - # Install the EPEL repository sudo yum install epel-release # Install Java 8 sudo yum install java-1.8.0-openjdk # Set Java 8 as the default sudo alternatives --config java · To compile a Java source file, use the javac command.
🌐
Oracle
docs.oracle.com › javase › 8 › docs › technotes › guides › install › linux_jdk.html
6 JDK Installation for Linux Platforms
April 21, 2026 - This page describes JDK for Linux system requirements and gives installation instructions for several JDK-Linux combinations.
🌐
TecAdmin
tecadmin.net › install-oracle-java-8-ubuntu-via-ppa
How to Install Java 8 on Ubuntu and Linux Mint
April 26, 2025 - Begin by updating your package index to ensure you have access to the latest software versions. Execute the following command in your terminal: ... Install OpenJDK 8 by running ...
🌐
Red Hat
docs.redhat.com › en › documentation › red_hat_build_of_openjdk › 8 › html-single › installing_and_using_red_hat_build_of_openjdk_8_for_rhel › index
Installing and using Red Hat build of OpenJDK 8 for RHEL | Red Hat build of OpenJDK | 8 | Red Hat Documentation
Create a directory to where you want to download the archive file, and then navigate to that directory on your command-line interface (CLI). For example: ... Navigate to the Software Downloads page on the Red Hat Customer Portal. Select the latest version of Red Hat build of OpenJDK 8 from ...
Find elsewhere
🌐
Techoral
techoral.com › blog › java › install-openjdk-8-linux.html
Open Jdk - How To Install OpenJDK Java 8 On Linux Real Quick
March 22, 2026 - $ su -c "yum install java-1.8.0-openjdk" The java-1.8.0-openjdk package contains just the Java Runtime Environment. If you want to develop Java programs then please install the java-1.8.0-openjdk-deve1 package.
🌐
OpenJDK
openjdk.org › install
OpenJDK: Download and install
As an example, the archives for JDK 13 may be found on jdk.java.net/13 and may be extracted on the command line using · $ tar xvf openjdk-13*_bin.tar.gz · or · $ unzip openjdk-13*_bin.zip · depending on the archive type. On the command line, type: $ sudo apt-get install openjdk-8-jre ·
🌐
Red Hat
developers.redhat.com › blog › 2018 › 12 › 10 › install-java-rhel8
How to install Java 17 and 21 on Red Hat Enterprise Linux 8 | Red Hat Developer
September 3, 2024 - This approach is handy if you don’t have root privileges, but both JDKs are already installed on your system. ... $ JAVA_HOME=/usr/lib/jvm/java-21-openjdk mvn --version Apache Maven 3.5.4 (Red Hat 3.5.4-5) Maven home: /usr/share/maven Java version: 21.0.4, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-21-openjdk-21.0.4.0.7-1.el8.x86_64 Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "4.18.0-513.5.1.el8_9.x86_64", arch: "amd64", family: "unix"
🌐
WiKID Systems
wikidsystems.com › support › faq › how-can-i-install-oracle-jdk-8-from-the-command-line
How can I install Oracle JDK 8 from the command line?
curl -v -j -k -L -H "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u51-b16/jdk-8u51-linux-x64.rpm > jdk-8u51-linux-x64.rpm ... At this point you should upgrade your WiKID rpms. (There's a bug in release 4.0.3-b1903 that over-writes the JCE policy with older ones.) If you need to upgrade or install WiKID, do so now.
Top answer
1 of 2
5

You have just extracted the binary file but you didn't set JAVA_HOME. First set the JAVA_HOME in your profile i.e. in ~/.bashrc file.

export JAVA_HOME=/usr/local/java/jdk1.8.0_45
export PATH=$PATH:$JAVA_HOME/bin

Reload the ~/.bashrc file as

> source ~/.bashrc press enter

Then try again.

> java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
2 of 2
0

The best way to do this is to use update alternatives not using JAVA_HOME. I downloaded the latest tarball jdk-8u162-linux-x64.tar.gz into a subdirectory ./src. I've also set up /opt so that it is owned by me, otherwise you need to use sudo for the untarring of the .tar.gz file.

#!/usr/bin/env bash

MAJOR_VERSION=8
ORACLE_BUILD_VERSION=162

JDK_TARBALL_VERSION=8u${ORACLE_BUILD_VERSION}-linux-x64
JDK_VERSION=1.${MAJOR_VERSION}.0_${ORACLE_BUILD_VERSION}
PRIORITY="10${MAJOR_VERSION}1"

cd src && tar xzf jdk-${JDK_TARBALL_VERSION}.tar.gz -C /opt/jdk

sudo update-alternatives --install /usr/bin/java java /opt/jdk/jdk${JDK_VERSION}/bin/java ${PRIORITY}
sudo update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk${JDK_VERSION}/bin/javac ${PRIORITY}

echo "Checking: alternatives on java and javac"
sudo update-alternatives --display java
sudo update-alternatives --display javac

echo "Running: java -version"
java -version

I've included build 162 since this is much more recent that 45 in your message. This script above should be provided to everyone in the field of development since we can see currently that oracle-java8-installer for Debian and Ubuntu is broken as of yesterday. It might be fixed in a few days but this script will always work.

The priority value in the script is really important since you must override existing priority of the installed package. I've set it to use the major version to be installed. This priority would only fail if you have openjdk version 9 installed.

🌐
Red Hat
docs.redhat.com › en › documentation › red_hat_build_of_openjdk › 8 › html › installing_and_using_red_hat_build_of_openjdk_8_for_rhel › assembly_installing-openjdk-8-on-red-hat-enterprise-linux_openjdk
Chapter 2. Installing Red Hat build of OpenJDK 8 on Red Hat Enterprise Linux | Installing and using Red Hat build of OpenJDK 8 for RHEL | Red Hat build of OpenJDK | 8 | Red Hat Documentation
Create a directory to where you want to download the archive file, and then navigate to that directory on your command-line interface (CLI). For example: ... Navigate to the Software Downloads page on the Red Hat Customer Portal. Select the latest version of Red Hat build of OpenJDK 8 from ...
🌐
Stack Overflow
stackoverflow.com › questions › 71017113 › how-to-install-jdk-8-on-ubuntu-server-18-04
java - How to install jdk 8 on ubuntu server 18.04? - Stack Overflow
Command 'java' not found, but can be installed with: sudo apt install default-jre sudo apt install openjdk-11-jre-headless sudo apt install openjdk-8-jre-headless
🌐
Liquid Web
liquidweb.com › home › how to install oracle java 8 on ubuntu 22.04
How To Install Oracle Java 8 on Ubuntu 22.04 | Liquid Web
December 2, 2024 - Otherwise, this tutorial guides you through how to install Java 8 (Java Development Kit) and set the path of the JAVA_HOME variable. ... Open a terminal and log in as root. If you are logged in as another user, you will need to add sudo before each command. We will be working on a Liquid Web Core-Managed Linux ...
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-install-java-with-apt-get-on-ubuntu-16-04
How To Install Java with Apt-Get on Ubuntu 16.04 | DigitalOcean
April 23, 2016 - When issuing the command: sudo add-apt-repository ppa:webupd8team/java You can get: sudo: add-apt-repository: command not found To solve this, do the next: sudo apt-get install software-properties-common And then rerun adding your repository. ... Noticed this line in the installer there is ...
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-install-java-with-apt-on-ubuntu-18-04
How To Install Java with Apt on Ubuntu 18.04 | DigitalOcean
October 12, 2021 - Install the software-properties-common package, which adds the add-apt-repository command to your system: ... Outputgpg: key EA8CACC073C3DB2A: public key "Launchpad PPA for Linux Uprising" imported gpg: Total number processed: 1 gpg: imported: 1 · Then use the add-apt-repository command to add the repo to your list of package sources: ... Output Oracle Java 11 (LTS) and 12 installer for Ubuntu, Linux Mint and Debian.