Install JDK on Linux

Step 1: Download and Install Oracle Java Development Kit (JDK)

The very first step is to download the Oracle Java Development Kit (JDK) from the Official Oracle Website. For that, Head over to the Official Website.

 

You need to identify your system specifications to choose the Product/file description. The website will contain the latest version for your corresponding system. For Linux, we’ll be downloading the latest x64 Debian Package of Java SE Development Kit 18. To install the downloaded JDK File using terminal, Open terminal and change your directory to downloads by using the command

$ cd downloads

To list files and packages present in the directory, Type

$ ls

 

Now we use Debian Package Manager to configure our downloaded file for installation by typing

$ sudo dpkg -i jdk-{YOUR_JDK_VERSION}         (replace {-} with your version)

Enter your password as we have run an elevated prompt, i.e. the sudo or superuser do command, which is a quick way to grant specific users permission to perform specific system commands at the system’s root (most powerful) level.

 

Now, Type the following commands to proceed with the installation

$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-{YOUR_JDK_VERSION}/bin/java 1
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-{YOUR_JDK_VERSION}/bin/javac 1

Step 2: Check the Java Version

Open the terminal and enter the following commands

$ java --version
$ javac --version

 

Step 3: Configure JAVA_HOME Environment Variable

After the installation is complete, we have to configure environment variables to notify the system about the directory in which jdk files are located. To find the Location of the JDK Files, run this command

$ sudo update-alternatives --config java

and copy the File Location.

In order to set the environment variable, you have to edit the environment file using this command

$ sudo gedit /etc/environment

Proceed to add JAVA_HOME=” /usr/lib/jvm/jdk-{YOUR_JDK_VERSION}

Proceed to save and close the file.

 

Now we have to refresh the environment file by using this command

$ SOURCE /etc/environment

And echo the JAVA_HOME Path

$ echo $JAVA_HOME

Download and Install Java Development Kit (JDK) on Windows, Mac, and Linux

Setting up a Suitable Development Environment is necessary before one can begin creating Android Applications. It makes it easier for developers to use the tools required to create any Application and ensures that all Operations or Processes run smoothly. Download and Install JDK in order to create Android Application Source Files using the Java or Kotlin Programming Language. The system will execute the code using a set of Libraries and Compilers. JDK, JRE, and JVM should not be confused with one another, for more Differences between JDK, JRE, and JVM. This article describes the step-by-step process for installing and configuring the JDK on the 3 most popular Computer Operating Systems in order to begin the process of developing Android Applications.

Similar Reads

Java JDK Download

The JDK can be installed on the following Platforms:...

Install JDK on Microsoft Windows

Step 1: Download and Install Java Development Kit (JDK)...

Install JDK on Linux

Step 1: Download and Install Oracle Java Development Kit (JDK)...

Install JDK on MacOS

Step 1: Download and Install Oracle Java Development Kit (JDK)...

Contact Us