December 19, 2023

Installing Java in Windows

This post shows how to install Java in Windows 10. Steps for installing Java in Windows are as follows.

  1. Downloading the latest version of Java.
  2. Installing Java by using the downloaded JDK installer.
  3. Setting the PATH Environment Variable

Downloading Java

You need to download the JDK installer from this location- http://www.oracle.com/technetwork/java/javase/downloads/index.html

Latest version of Java would be at the top which happens to be Java SE 10.0.2 at the time of writing, by scrolling down you can see the other versions of JDK too.

Installing Java Windows

Click the download button below JDK.

You can download JRE if you just want to run Java applications on your system but JDK contains many other tools helpful for development. As per Oracle site this is the description.

  • Software Developers: JDK (Java SE Development Kit). For Java Developers. Includes a complete JRE plus tools for developing, debugging, and monitoring Java applications.
  • End user running Java on a desktop: JRE:(Java Runtime Environment). Covers most end-users needs. Contains everything required to run Java applications on your system.

Once you click the download button you would be taken to the page where you need to accept license agreement and download the java exe file as per your requirement. Note that from Java 9 on wards only 64 bit JDK download is available, till Java 8 there was choice of both 32 bit and 64 bit.

Installing Java using JDK installer in Windows

Once you have the exe file downloaded you can run it by double clicking it that will start the JDK installer. Just follow the instructions provided by the Installation wizard.

Setting the PATH Environment Variable

It is useful to set the PATH variable permanently for Java so that it is persistent after the system is rebooted. Otherwise you will have to give the full path every time you run a program.

To set the PATH variable permanently you need to add the path to jdk-10\bin directory in your Java installation to the PATH variable. Typically the full path would be similar to as follows-

C:\Program Files\Java\jdk-10.0.1\bin 

To set the PATH variable in Windows 10, right click on “This PC” and select Properties. Alternatively you go to Control Panel – System to open the same screen.
Click on Advanced System Settings – Advanced – Environment Variables

There you need to add the location of the bin folder of the JDK installation to the Path variable in System Variables.

For that select path and click Edit and add the path to bin directory in your Java installation- C:\Program Files\Java\jdk-10.0.1\bin

Note that Java 9 onwards JAVA_HOME variable is not needed. If you are installing any older version you also need to add JAVA_HOME variable. Under system variables click New. In the Variable Name field enter “JAVA_HOME” and as value enter the JDK installation path – C:\Program Files\Java\jdk-10.0.1

Want to write your first Java program after installing Java, have a look at this post- Writing First Java Program – Hello World

That’s all for the topic Installing Java in Windows. If something is missing or you have something to share about the topic please write a comment.


You may also like

No comments:

Post a Comment