Install JDK on Ubuntu in 6 Steps

Install JDK on Ubuntu in 6 Steps

The Java Development Kit (JDK) is an implementation of either one of the Java Platform, Standard Edition, Java Platform, Enterprise Edition, or Java Platform, Micro Edition platforms released by Oracle Corporation in the form of a binary product aimed at Java developers on Solaris, Linux, macOS or Windows.The JDK includes a private JVM(Java Virtual Machine) and a few other resources to finish the development of a Java Application

We need JDK because it is a bundle of software components that is used to develop Java based applications and it includes JRE , the compilers and tools (like JavaDoc, and Java Debugger) to create and compile programs.

To install it on Ubuntu we need to follow some steps : –

Step 1-First of All we need to download JDK file using this link  (Don’t forget to Accept License Agreement) and Download bin.tar.gz file

Install JDK on Ubuntu in 6 Steps 1

Step 2– Now go to terminal (Ctrl + Alt + T) then go to where file is downloaded in my case

$ cd ~/Downloads/

Step 3– Now to extract use command

$ sudo tar xvzf jdk-10_linux-x64_bin.tar.gz -C /installDirectory

Step 4– Now we have to add Oracle JDK 10 to  PATH environment variable. Otherwise we will have to specify the full path when we run the Oracle JDK 10 commands.

To add Oracle JDK 10 to  PATH environment variable, we need to create a new file jdk10.sh in /etc/profile.d with the following command:

so use any editor in my case i am using “nano”

$ sudo nano /etc/profile.d/jdk10.sh

Step 5– Add following lines in JDK10.sh (Don’t forget to enter your directory where you have installed JDK in place of installDirectory) after this press cntrl + X ( ^X ) then Enter y

export JAVA_HOME="installDirectory/jdk-10"
export PATH="$PATH:${JAVA_HOME}/bin"

Install JDK on Ubuntu in 6 Steps 3

 

Step 6– Now you have to restart your computer for the changes to take effect and to check JDK correctly installed use these commands

$ echo $JAVA_HOME
$ echo $PATH
$ java -version

That’s all these are the 6 steps to install JDK on Ubuntu

Share this post

Leave a Reply

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


%d bloggers like this: