How to Install Oracle Java 8 on Ubuntu 18 04 LTS Manually

Published: 31 March 2020
on channel: DevOps Hint
901
10

How to Download and Install Oracle JAVA 8 on Ubuntu 18.04 Manually

#installoraclejava #installjavaubuntu #java #ubuntu

Please follow below article for step by step commands
https://www.fosstechnix.com/install-o...



 Prerequisites

• Ubuntu Server 18.04/16.04 LTS
• SSH access with sudo privileges
To check Ubuntu version:
$ uname -a
OR

$ cat /etc/os-release


Step 1: Download Oracle Java 8

Generally Oracle will not allow to download directly without accepting their licences. We have to create one account in Oracle java website by your personal or official mail. After accepting licence download the application from browser to local machine.
https://www.oracle.com/java/technolog...

Step 2: Copy downloaded Setup and Extract

Create a directory /opt/jdk
$ sudo mkdir -p /opt/jdk
Copy the tar file from the directory copied from local machine to server to /opt/jdk folder and execute below command:
$ sudo cp -rf jdk-8u241-linux-x64.tar.gz /opt/jdk/
$ cd /opt/jdk/
$ sudo tar -zxf jdk-8u241-linux-x64.tar.gz
Now unarchived the file and check the content by long-list:
ls

Step 3: Install Oracle Java 8 on ubuntu with Alternatives

Use update-alternatives command to configure java on your system

$ sudo update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_241/bin/java 100

Step 4: Verify Update Alternatives

Enter below command shows output:

$ sudo update-alternatives --display java
To change for alternative mode:

$ sudo update-alternatives --config java

It prompts for selecting by 0,1,2..so choose accordingly:

Step 5: Setting the JAVA_HOME and JRE_HOME Environment Variables

To define the enviroment variable:
$ sudo nano /etc/environment

Paste the below variable on the file:

JAVA_HOME=/opt/jdk/jdk1.8.0_241

JRE_HOME=/opt/jdk/jdk1.8.0_241/jre

To check variables defined:
$ source /etc/environment
$ echo $JAVA_HOME

Update the system packages
$ sudo apt-get update

Step 6: Verify Java Version
To check the java version:
$ java -version


Watch video How to Install Oracle Java 8 on Ubuntu 18 04 LTS Manually online without registration, duration hours minute second in high quality. This video was added by user DevOps Hint 31 March 2020, don't forget to share it with your friends and acquaintances, it has been viewed on our site 901 once and liked it 10 people.