Java installation and setup for windows

In this tutorial, you will be learning to install the JAVA JDK  along with setting up a path for its environment variables in your WINDOWS  system. 

If you are a beginner and don’t know how to get started with JAVA, this tutorial is the best guide for you. Initially, we will examine whether java is already present in your system or not. If not, will escort you to help in solving some doubts that wander in your head like how do I download and install java for free, Which version of JAVA should  I use, How to set or declare environment variables in java, etc.

How to check if JAVA is installed or not

Let’s begin by checking the presence of JAVA in your system. This can be achieved by simply finding the version of java in your system, java version will be displayed as a result if java already exists otherwise some error message will be displayed. Follow the below instructions and corresponding pictures for easy understanding.

  1. Open a command prompt on your computer by typing “cmd” in the search bar as shown.
    Java Install - Command prompt
  2. In the command prompt just enter “java - version” as shown and press Enter.
    • If java is not present in your system then a message ‘java is not recognized as an internal or external command, operable program or batch file.’ will be displayed.
      Java Install - Command prompt
    • If java is already present in your system then the java version present in your system will be displayed as shown in the below screenshot. Also, you can check with the “javac” command 
      Java Install - Command prompt

How to download java for free?

Now we are sure that java is not available in the system, so it is time to download JAVA for free following the below guidelines.

  1. Open any of your favorite browsers.
    •  Type “JDK download” in the search bar and hit the enter key. You will get a screen like below with the link from the official Java site, Oracle.
      Java Install - Search
  2. On clicking the above link you will be directed to the Java SE downloads page as given below.  
    • At the time of creating this tutorial, JAVA SE 15 is the latest version of Java. 
      Java Install - Oracle
    • As you scroll down this page you can see several other versions of Java also.
    • To download the latest version, click on the link stating JDK Download which is enclosed in a red rectangle box in the above screenshot.    
  3. This will take you to the Java SE Development Kit page.
    Java SE Development Kit page
  4. When you scroll down you will reach the location where it says Java SE  Development Kit 15.0.2 which is the latest version available while creating this tutorial. Under this, you can find various operating systems to which this JAVA JDK is available. Choose the one that suits your system. 
    • For Windows 10 operating, the jdk-15.0.2_windows-x64_bin.exe file is available, and click to download  .
      Java Install - Windows
    • Subsequently, a dialogue box as shown in the screenshot below will appear. Ticking the checkbox you are accepting the terms and conditions and finally press the download button which downloads the JDK kit to your system.
      Java Install - Windows
  5. Now the file is successfully downloaded into your system 
    Java Install - Windows

How to install java?

We need to install this into our system using the below instructions.

  1. Now open the JDK file right away after downloading or later from the download folder. As soon as you open it a dialogue box will appear, click yes.
  2. This will take you to the initial setup window as given below, then click Next.
    Java Install - Windows
  3. On hitting next you will be taken to another window where you can set the destination folder to install the Java JDK file.You can choose
    1. Default destination folder, then click next 
    2. To change the destination folder, just click the change button near it and change the location and then click Next.
    Java Install - Windows
  4. Now the installation begins and a window like below appears to show the status of the installation. 
    Java Install - Windows
  5. Once the installation is complete, a window as shown below will turn up and this says the JDK is successfully installed to your system. Click close then.
    Java Install - Windows
  6. To verify the installation is successful, just visit the location where the Java file is installed. In our case by default, the java file is located inside the program files in C drive as shown in the window below.
    Java Install - Windows
  7. When you open the Java Folder you can see another folder named jdk.15.0.2 which contains all the necessary folders and files required to work in java. 
    Java Install - Windows
  8. Open the JDK folder will present you some Java-related folders out of which the bin folder is the most important one as it occupies most of the Java-related executable files and such.
    Java Install - Windows

 

How to set the path for environment variables?

We have already seen that the bin folder in the JDK 15.0.2 contains all the java executable files, so as to establish a connection with the command prompt or editor we need to set up a path. A path is generally an environment variable in OS used to specify a set of directories in a file system.To set up the path, use the below instructions:

  1. Copy the path of the bin folder 
    Copy the path of the bin folder
  2. Open the windows settings by clicking the window icon on the bottom left corner of your screen.
    Open Settings
  3. On hitting the Settings it will take you to another window where on the search bar just type “environment variables” which gives you two options 
    1. Edit the system environment variables 
    2. Edit the environment variables for your account.

    Select the first option and proceed. 

    Copy the path of the bin folder
  4. Below the window will appear. From the “Advanced” tab select the button for Environment variables and click OK. 
    Environment variables
  5.  A window like below will appear towards you. Here 
    1. Choose the Path in the system variables 
    2. Then click on the Edit button.
    Environment variables
  6. Now you will end up on the page shown below where you need to
    1. Paste the copied file path and press Enter.
    2. Then click OK
    Environment variables

    Now the path is set. 

  7. This is an optional setup, if you want to use other java related tools you can set up a JAVA_HOME path simply by clicking on the New button in the System Variables.
    System variables
  8. A window like below will appear with blank fields
    1. You can give the variable name as you wish, here, we entitled it as JAVA_HOME  
    2. The variable value is the path to the JDK folder. So copy the folder path from the system and paste it as shown in the picture.
    3. Then click OK
       
    System variables

Thus the installation and path setting of JAVA is completed and now you can start using java for your works.