Java is one of the most favorite programming language used by millions of applications and programs today. Java runs on various platforms like Windows, Unix, and mac os. It is very essential to understand how to install Java.
In this tutorial, I will be showing how to install Java on a Windows machine. The very first step is to download it from the official website.
- First of all, download the latest version of Java from the official oracle site link.
- Apparently, you need to choose the OS type and architecture (32 or 64 bit). If you are using windows 64 bit, then download JDK for Windows x64.
- Note: this single setup contains both JDK and JRE (Java Runtime Environment), so it is not required to explicitly download JRE 8. JDK download and installation is sufficient.
- Choosing the default location for installation, and you will get the following folder under C:\Windows\Program Files\Java.
Set Java Home (Install Java)
Once Java is installed, you need to add a new environment variable called JAVA_HOME and update the PATH variable with Java home. Below are the steps.
- Open the explorer, right-clicks on This PC, and click on Properties. You will see the below screenshot.
- Click on the Advanced system settings link from the left-end side. You will see the below screen.
- Click on Environment Variables.. button, and you will see windows like the below screenshot.
- The upper section defines the variables available to the current window user only. The lower section shows the variables available to all users.
- Click on New.. button from the lower section and add entries like the below screenshot.
- Give variable name as JAVA_HOME and its value as the path of your JDK folder (you have two folders under C:\Program File\Java, you need to choose the JDK folder).
- Note: I have 1.8.0_60, but you may have updated a minor version.
Update Path environment variable
Next is to update the Path environment variable. Below are the steps.
- Select Path from the lower section and click on the Edit button. You will see new windows.
- Click on the New button, and you will see a new blank entry. Just add %JAVA_HOME%\bin there. Click on the OK button.
- Again click on the OK button.
- Open command prompt and type java -version. If you see the output like the below screenshot, it means Java 8 is installed and configured properly.
- Note: You may have an updated minor version.
Congratulation ….!!! Java is installed successfully on your machine. You can start using it.