Setup Java 8 in Linux machine1 min read

Prabhin Prabharkaran Administrator
DevOps Engineer

He is a Technical professional. He is a person who loves to share tricks and tips on the Internet. He Posts what he does!

follow me

In this Tutorial we will showing you how to setup Java 8 in Linux machine. Java is a dependency packaga for most of the applications.

Installation

First we will update the server

yum update

Next we will install java 8 in the server.

Here we will show you how to setup java and later on apache tomcat.
This document will work from most of the linux distros such as Ubuntu, Centos, Amazon Linux, Redhat

Java Setup

Step 1: Download the latest JDK

It is recommended that you install only the latest JDK.

 

wget http://download.oracle.com/otn-pub/java/jdk/8u161-b12/2f38c3b165be4555a1fa6e98c45e0808/jdk-8u161-linux-x64.tar.gz

Step 2: Extract JDK to Java’s default location

Create a java folder in /usr which is the default location for Java.

sudo mkdir /usr/java

step 3: Go to the created /usr/java

cd /usr/java

Extract the downloaded JDK.

sudo tar -xvzf /path/downloaded/jdk-8u161-linux-x64.tar.gz

Step 4: Once files are extracted in add the following lines in end of the file.

vi /etc/profile

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

Step 5: Once enter the above 2 lines in the file execute the following command.

source /etc/profile

Then check java version

java -version

It will show the sample output

root@www:/home/prabhin# java -version

openjdk version “1.8.0_151”
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.16.04.2-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)

 

© 2018, Techrunnr. All rights reserved.

#1
#2
#3
Questions Answered
Articles Written
Overall Points

Related posts

Leave a Reply