How to install Oracle Java 8 64-bit Ubuntu 24.04 | 22.04 | 20.04 LTS

Learn the commands to download & install Oracle Jave 8 64-bit on Ubuntu 24.04 Noble, 20.04 Focal Fossa, or Ubuntu 22.04 Jammy Jellyfish using the terminal.

A programming language, in general, allows you to formulate programs and specify their behavior. For example, you can program your pocket calculator with a few lines of text code.

Java is a popular programming language owned by the company “Sun Microsystems” but later bought by Oracle in 2010.  The first version of Java appeared in 1995 and, along with C, is one of the most famous programming languages ​​in the world. It belongs to the object-oriented programming language group, meaning written programs are structured in classes and objects. The programming languages C++, C#, and Objective-C mainly influenced Java. Java is primarily used to program web applications, desktop applications, and apps. For example, Google’s Android operating system apps are developed in Java.

As Linux systems are open source, the packages available to install via their official repositories are mainly free and open source. That’s why the Java version available to them to install by default using the package manager is OpenJDK- the open-source implementation of Java by its community. However, those who want to install the official Oracle Java 8 version on their Linux systems can also do that. In this tutorial, we will learn how to do that.

Steps to install Oracle Java 8 on Ubuntu 24.04 | 22.04 | 20.04

The steps to download and set up Java 8 on Linux will be the same for other distros such as Mint, CentOS, RedHat, AlamLinux, Rocky Linux, Manjaro, etc.

Run system update, and have wget

Although running an update is not necessary here but to get wget package and ensure the system repository cache is up to date, run it once. Along with the commands to install wget tool.

sudo apt update
sudo apt install wget

 

Download Oracle Java 8 for Linux

As mentioned, Oracle Java 8 is not officially available to install using the APT package manager; instead, OpenJDK is available.

Visit the official website and download the Jave 8 for Linux.

Java 8 Linux download

You can also copy and download the link using the command below.

wget "https://javadl.oracle.com/webapps/download/AutoDL?BundleId=245797_df5ad55fdd604472a86a45a217032c7d" -O java-8.tar.gz

 

Extract Java 8 Tar file on Linux.

Create a directory where you want to extract and keep the files safely to use with various applications that require Java.

sudo mkdir /usr/java

Once the archive file is downloaded on your system, extract it using the default Tar tool. Here is the syntax

tar -xf file-name.tar.gz -C /target-directory

Hence, the command will be:

tar -xf java-8.tar.gz -C /usr/java

 

Check Java 8 Version on Ubuntu 24.04 | 20.04 | 22.04

The Java binary is available inside the extracted folder under the bin directory. Let’s first switch to that and then check the version of Oracle Java we have received to use.

cd /usr/java/jre1.8*/bin
./java -version
Check Java 8 Version on Ubuntu 20.04 22.04

Don’t get confused with 1.8.0_321 and Java v8; they are the same.

 

Add the folder to your system PATH.

Now, let’s add the folder in which you extracted Java 8 to our system path so that we can use it regardless of the current directory.

Here is the syntax to do that:

echo 'export PATH="$PATH:/full-path-to-executable-folder"' >> ~/.bashrc

For example, we have extracted the file under /usr/java/jre1.8.0_321/bin, hence this will be the executable folder path. Use the full path as we did, the version number would be different in your case.

Then the above command will be:

echo 'export PATH="$PATH:/usr/java/jre1.8.0_321/bin"' >> ~/.bashrc

Reload bash shell:

source ~/.bashrc

Check version:

java -version
Add Oracle Java 8 to Linux system path

 

Uninstall or Remove Java 8 from Ubuntu

In the future, if you want to delete or remove the installed Java 8 version of Oracle from your Ubuntu 24.04, 20.04, or 22.04 Linux, then run the following command:

sudo rm -r /usr/java/jre1.8*

Also, remove the exported path variable:

nano ~/.bashrc

Scroll down and delete the line:

export PATH="$PATH:/usr/java/jre1.8.0_321/bin"

Save the file Ctrl+O, hit the Enter, and then Ctrl+X to exit.

 

Other Articles:

2 ways to install Oracle Java 17 on Ubuntu 20.04 | 22.04 LTS
3 Ways to install Zotero on Ubuntu 22.04 or 20.04 LTS
How to install MySQL 8.0 Server on Debian 11 Bullseye

 

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.