JDK is java development kit. If you are working with java software programming language then you must need to install it as it is prerequisite to code and run java software programs, use testng framework or to use SDK. Many peoples don't know how to install JDK and configure environment variable for JAVA_HOME. Bellow given steps will guide you to install java software in windows and set JAVA_HOME.
Step 1 : Install JDK
- Go to JDK DOWNLOAD PAGE of software web application.
- Click on JDK download button as shown in bellow image.
- It will take you to Java SE Development Kit 8 Downloads page.
- Tick "Accept License Agreement" radio button and click on .exe link to download JDK based on your OS as shown in bellow image. Select "Windows x86" for 32 bit system and "Windows x64" for 64 bit system.
- When you will click on link, It will show you dialog to save .exe file.
- Double click on downloaded .exe file.
- Click on Next button on each step using default selections. It will take some time to install JDK and at last of installation, It will show screen like bellow to close installation dialog.
Java is installed now. Now you need to set JAVA_HOME variable in windows. Bellow given steps will set it.
Set JAVA_HOME Variable In Windows
After installation of java software, You need to set JAVA_HOME variable in your windows system Steps to set JAVA_HOME are as bellow.
Locate JDK Installation folder path
First of all you need to locate path of JDK installation folder.
- Go to C:\Program Files\Java.
- There will be JDK folder with version number. Example : For me it is "jdk1.8.0_45".
- Double click on It.
- Copy folder path. Example : C:\Program Files\Java\jdk1.8.0_45
This path will be required to set environment variable as described in bellow given steps.
Set JAVA_HOME Variable
- Right click on My Computer icon which is located on your desktop or win start.
- Select Properties.
- It will open system configuration dialog.
- Click on Advanced system settings as shown in bellow image. It will open system properties dialog.
- Select advanced tab -> Click on Environment Variables button. It will open Environment Variables dialog.
- Under System Variable, Click on New button. It will open New System Variable dialog.
- Set Variable name = JAVA_HOME.
- Set Variable Value = Path where JDK is located. For me It is "C:\Program Files\Java\jdk1.8.0_45" which is located during previous step as described above . It depends on your own java installation path and installed version.
- Close all dialog by clicking on OK buttons as described in above image.
Set Path Variable For Java
Also you need to set JDK's bin folder path in path variable of system variables. You will find bin folder inside your JDK folder. To set path system variable of JDK,
- Open Environment Variables dialog as described above.
- Under System Variable select Path variable.
- Click on Edit button. It will open Path system variable edit dialog.
- At the end of Path variable value string, Put semicolon and then put JDK folder's bin folder path.
- Click on OK button to close all opened dialog. See bellow given image for more reference.
Verify java is installed properly or not
- Open command prompt.
- Run command "java -version"
It should show your installed java version detail as shown in bellow image. That means java is installed in your computer and you are ready to use it.