This tutorial will guide you step by step how to download and install Java Development Kit (JDK) in Windows. The Java JDK allows you to develop Java applications and run them.
If you installed multiple JDK versions on the same PC, we recommend that you install the only latest version of JDK. Before going to download. we need to have the following:
1. Internet browsers like Firefox, Google Chrome, or Internet Explorer.
2. Internet Connection to download and install.
Download & Install Java JDK in Windows
Follow all the below steps to complete the download and installation of Java Software Development Kit (JDK) in Windows:
1. Visit the Oracle download page in your browser and download the latest version of JDK from the following link:
2. Accept License Agreement and download the latest Java JDK for your version (64 bit) of java for Windows.
The type of installation may depend on your system requirements and platform that you will choose to install.
Once the JDK exe file has been downloaded to your computer from the website, double click on the downloaded exe file and run the installation of Java software on your computer.
3. You must follow all the instructions provided by the installation wizard.
4. Once the installation process is completed, check the program files folder of C:/ Drive. This folder must contain a Java folder with JDK and JRE sub-folders.
If you see these sub-folders in your C:/ Drive’s program files folder, it means that the installation of Java is completed. Now, you can delete the downloaded file to recover the disk space.
5. In the third step, you will have to check the Java configuration to make sure that the Java files are identified by the computer or not.
For this, you will have to set the PATH variable permanently for JDK 13 so that it is persistent after reboot.
If you do not set the PATH variable, then you must have to specify the full path every time to execute program that you run it.
C:> “C:\Program Files\Java\jdk-13\bin\javac” MyClass.java
So, let’s set the full path in the system.
How to set Path and Classpath in Environment Variables for Java?
Once the Java Software Development Kit has been installed successfully, the next step is to set up Path and Classpath in environment variables permanently in your system.
Environment variables are special Windows operating system variables that are used to identify the installation directory, location of temporary files, tools, and profile settings.
They contain values that can be used by programs. Since the value of environment variable is changeable and updateable, environment variable is dynamic in nature.
Some of the common environment variables are as follows:
1. %appdata%: Location of Application Data folder for your user profile.
2. %commonprogramfiles%: Location of Common Files folder, within the main Program Files folder.
3. %path%: Location of various tools e.g. Java tools.
4. %programfiles%: Location of where programs are installed.
5. %temp%: Location of temporary files.
6. %windir%: Location of windows system files.
The Path variable gives the location of the bin folder and the Classpath variable gives the location of Java files.
Whenever Java programs are compiled and executed on the computer, the computer needs to know where java files are located and what is respective PATH of bin folder?
So, Java file location (library files) is provided through the ClASSPATH variable.
Steps to set Path variable on Microsoft Windows
Path variable gives the location of tools. Specifically, it identifies the location of Java compiler (Javac.exe) and java interpreter (Java.exe).
There are two ways to set path variable that are as follows:
- Control Panel
- Command Line
Setting Path using Control panel:
Setting the Path variable using control panel is a superior way because it will be permanent. Follow all the steps below to set the PATH variable using the control panel on Microsoft Windows:
1. Go to the Start menu and navigate to the Control panel.
2. In the Control panel, you will see a System icon. Now double-click on this icon.
3. Go to the Advanced system setting and click on it. You can see the below screenshot.
4. A system properties dialog window box will be displayed as shown in the below screenshot.
5. Click on the Environment variables.
6. Now click on the New button in System variable. You will see a new window dialog box “New System Variable” as shown in the below screenshot.
7. Write “PATH” as a variable name and enter the location of the JDK bin folder in the variable value. A typical value for the PATH variable is shown below:
Now click on the OK button.
Note: In case you have already created a PATH variable in your system, edit the PATH variable to
PATH = <JDK installation directory>bin;%PATH%; Here, %PATH% join the existing path variable to our new value. You must have only one bin directory for a JDK in the path at a time.
8. You can follow similar steps to set CLASSPATH. Write “CLASSPATH” as a variable name and enter the location of the JDK lib folder in the variable value.
The following is a typical value for the CLASSPATH variable:
Now click on OK button.
Setting Path variable using Command Line:
Setting Path variable using the command line is temporary. It can be set using SET command. The SET command is not case sensitive.
This technique can apply only at the current command line. Let’s understand how to set Path variable at the command line.
Similarly for classpath:
Hope that this tutorial has covered almost all the important points to download and install Java Development Kit (JDK) on the computer system. I hope that you will have also understood how to set path in environment variables permanently.
In the next tutorial, we will learn how to write first simple Java program Hello world using Notepad.
Thanks for reading!!!
Next ⇒ How to write first simple Java Program