Setup Java 8 in Linux machine1 min read
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.
First we will update the server
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
Step 1: Download the latest JDK
It is recommended that you install only the latest JDK.
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
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.
Step 5: Once enter the above 2 lines in the file execute the following command.
Then check 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)