JDK Installation Steps
JDK Installation Steps
JDK Installation Steps
Download JDK
Open the browser and search for Download JDK 15 or click the link to download
from the Oracle website. It will show the JDK download page as shown in Fig 1.
Fig 1
Accept the License Agreement and click on the link to download the installer as
highlighted in Fig 2. It will start downloading JDK 15 installer for Windows.
Fig 2
Step 2 - Install JDK
Now execute the JDK installer by double-clicking it. It might ask system permission
before starting the installation. Click on yes to allow the installer to execute itself. It
shows the installer welcome screen as displayed in Fig 3.
Fig 3
Click the Next Button to initiate the installation process. The next screen shows
options to change the installation path. We can change the installation location on
this screen if required as displayed in Fig 4.
Fig 4
Now click the Next Button to start the installation. It will show the progress as
displayed in Fig 5.
Fig 5
It shows the success screen after completing the installation as mentioned in Fig 6.
Fig 6
Now open the Command Prompt and type the command java -version to confirm
whether it's installed successfully as mentioned in Fig 7.
Fig 7
It might show the message - java is not recognized as an internal or external
command or show the previously installed version. In order to start using the JDK
installed by us from the command prompt, we might be required to set the
environment variable. You can follow the below-mentioned steps to do so.
Right Click -> My Computer(This PC) -> Properties -> Advanced System Settings
The above steps will open the Windows settings panel as shown in Fig 8.
Fig 8
Now click the Environment Variables Button, select Path under System
Variables section and click the Edit Button. We need to add the path of installed JDK
to system Path.
Remove the path of previously installed JDK. Also, update JAVA_HOME in case it's
already set. Now click on New Button and add the path to installed JDK bin which
is C:\Java\Oracle\jdk-15\bin in my case as shown in Fig 9. Press OK Button 3 times
to close all the windows. This sets the JDK 15 on system environment variables to
access the same from the console.
Fig 9
Now again open the console and test the Java version as shown in Fig 10.
Fig 10
How To Install Java 11 On Ubuntu
Step 1 Download JDK
Open the browser and search for Download JDK 11 or click here to view the
download options. It will show the JDK download page as shown in Fig. 1.
Fig. 1
Now click on download option as highlighted in Fig 1. Accept License Agreement
and click on the download link having the tar.gz extension. A confirmation dialog will
be displayed to start the download as shown in Fig.2 and Fig. 3.
Fig. 2
Fig. 3
We can also download the JDK on terminal using the command as mentioned below:
>sudo wget -c --header "Cookie: oraclelicense=accept-
securebackup-cookie"
http://download.oracle.com/otn-pub/java/jdk/11+28/55eed80b163941c8885ad9298e6d786a/
jdk-11_linux-x64_bin.tar.gz
Step 2 Install Java
Open the terminal and make directory /usr/java ot done yet to keep java installations.
We can install multiple versions of Java in this directory. Now copy the downloaded
file to this location and extract it as shown below:
>sudo mkdir -p /usr/java
>cd /usr/java
>sudo cp jdk-11_linux-x64_bin.tar.gz
>sudo tar -xzvf jdk-11_linux-x64_bin.tar.gz
The above steps will install JDK to the path /usr/java/jdk-11
Step 3 Set Environment Variables
>sudo nano /etc/profile
Scroll down by pressing Page Down button and add at the end of this file:
JAVA_HOME=/usr/java/jdk-11
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export PATH
Now press Ctrl + O and press Enter to write our change. Press Ctrl + X to exit the
nano editor. The nano editor should look like the one shown in Fig. 4.
Fig. 4
Step 4 Configure Java Commands
Now we need to configure Java commands to newly installed JDK. We can check
the installed Java before and after executing these commands as shown below:
>java -version
>sudo update-alternatives --install "/usr/bin/java" "java"
"/usr/java/jdk-11/bin/java" 1
>sudo update-alternatives --install "/usr/bin/javac" "javac"
"/usr/java/jdk-11/bin/javac" 1
>java -version
The output of these commands is displayed on Fig. 5. We might need to configure
active Java if it is previously installed on the system as shown in Fig. 5.
Fig. 5