Practical 1
Installation JDK for Java
JDK has bare minimum requirements for disk space and RAM for the 64-bit Windows
platform. It requires around 800 MB disk space to install JDK, as JRE also gets installed
along with it. JDK requires 128 MB of memory space to run JDK successfully. This is
the minimum RAM required for running basic and small programs, but as the size of an
application increases, the memory requirement also increases for the application to run
smoothly.
Step by Step Installation Of JDK
Before installing the latest JDK version, it is recommended to check our systems for any
old JDK versions and uninstall them. Though we can have more than one JDK, it is
easier to set paths and to work with just the latest one.
Step 1: Download JDK from the Site
• Go to the Oracle site and open the Java SE download page. Under the latest
version of Java Platform, Standard Edition, click on the JDK download button.
Next, click on the Accept License Agreement button and choose your version of Java
for Windows (32-bit or 64-bit) to proceed with downloading the JDK executable file.
Step 2: Install the JDK exe File
• In this step, we will be running the executable JDK file (It will be a file with .exe
as an extension) once the download is done. This installs JDK as well as JRE.
For running this file on Windows, we will need Administrator rights.
• To begin the installation, we need to double-click on the downloaded file, and we
will be presented with the below window.
• Click on Next to proceed with the installation, and follow the Installation guide
provided for any queries.
• Click on the Close button once the installation has finished.
To recover some of our system’s disk space, it is good practice to delete the
downloaded exe file once the download has been done.
Step 3: Check the Directory
• JDK gets installed in the C directory of our system by default having the path
“C:\Program Files\Java\jdk-11.0”. If we make any change to this path at all, we
need to make a note of it as it will be required in the upcoming steps.
• This is the directory structure for our example.
Step 4: Update the Environment Variables
• We will need to update our system’s Environment variables with our installed
JDK bin path to run the Java programs because while executing the programs,
the command prompt will look for the complete JDK bin path.
• The PATH variable in our system provides the exact location of executables that
will be used for running Java programs, such as javac and java. The
CLASSPATH variable provides us with the library files location.
• If we do not set the PATH variable, we will specify the full path to the JDK bin
every time we run a program.
For example: C:\> “C:\Program Files\Java\jdk-11.0\bin\javac” TestClass.java
1. So to set these variables, first right-click on My PC and select Properties.
2. Inside Properties, in the left-side panel, select Advanced System Settings, and
here choose the option Environment Variables.
3. Click on New, and type PATH in the Variable Name, and enter the path of the bin
of installed JDK in the Variable Value field.
• If we already have the PATH variable, we can edit it by adding it to the existing
values.
• Click on the OK button to apply the changes.
Step 5: Verify the Java Installation
4. Open the command prompt and enter the command “java –version”, and if it runs
successfully, Java has been successfully installed.
5. Now that we have seen the steps to install JDK, let the programming fun begin!
Step 1: Download JDK from the Site
Step 2: Install the JDK exe F
Step 3: Check the Directory
Step 4: Update the Environment Variables
For example: C:\> “C:\Program Files\Java\jdk-11.0\bin\javac”
TestClass.java