Quick setup JDK 1.8 on Ubuntu 16.04


In this post, I am going to write about quick setup of JDK 8 on Ubuntu Linux 16.04 assuming a fresh installation of Linux and on the top of that java needs to be installed. 

Below are the steps for quick installation of JDK 1.8_x on Ubuntu Linux-

1. Login to your ubuntu linux machine as root user
2. Create a new directory at location / and provide necessary permission for read write and navigate to /u01


root@ubuntu:~
root@ubuntu:~ mkdir u01/
root@ubuntu:~ chmod 664 /u01
root@ubuntu:~ cd /u01

3. Download the Linux Compressed Archive archive from Oracle Official page- https://www.oracle.com/in/java/technologies/javase/javase-jdk8-downloads.html


Or just open the command line and use curl to download the same. For this you need a valid AuthParam because you need to be logged in to Oracle.com. So if you have and Oracle.com account just login and proceed to downloads page as specified in above link, go to respective download section and click on the download link. Now just copy the link from downloads bar and use the same for CURL GET request as shown below-

root@ubuntu:~ cd /u01 curl -X GET https://download.oracle.com/otn/java/jdk/8u251-b08/3d5a2bb8f8d4428bbe94aed7ec7ae784/jdk-8u251-linux-i586.tar.gz?AuthParam=1590566343_ac34e683ddfa497348ddc52c8241638e

Now check the same once completed-

root@ubuntu:~ ls -lrth
root@ubuntu:~ cd /u01 curl -X GET
total 186M
-rw-r--r-- 1 root root 186M Mth xx xx:xx jdk-8u251-linux-x64.tar.gz 

4. Extract the archive as
tar -xvf jdk-8u231-linux-x64.tar.gz 

Check the directory created inside u01 as-

root@ubuntu:/u01# ls -lrth
total 186M
drwxr-xr-x 7 uucp  143 4.0K Oct  5  2019 jdk1.8.0_251
-rw-r--r-- 1 root root 186M May xx 02:22 jdk-8u251-linux-x64.tar.gz

So our JDK has been extracted to a directory called jdk1.8.0_251.

5. Do entry of JDK path in bash_profile
root@ubuntu:/u01# vi ~/.bash_profile


export JAVA_HOME=/u01/jdk1.8.0_251
export PATH=$PATH:$JAVA_HOME/bin

Save it and quit.

5. Checking Java version
Now our JDK path has been set. Either reboot the machine for bash profile changes impact or source it as
root@ubuntu:/u01# source ~/.bash_profile

Now check your java version as-

root@ubuntu:~ java -version
java version "1.8.0_231"
Java(TM) SE Runtime Environment (build 1.8.0_251-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.251-b13, mixed mode)

Congratulations! We have our JDK 1.8.x successfully setup on Ubuntu Linux 16.04.


Comments

Post a Comment

Popular posts from this blog

Oracle SOA Suite- Implementing Email Notification

Oracle SOA Suite 12c- PKIX path building failed & unable to find valid certification path to requested target

Migration of Oracle SOA Suite Composite from 11g to 12c