How To Install Java (Windows & macOS)

In this post, we are going to learn about How to Install Java on Windows and Mac OS. For doing so you have to follow the below step:

Hope you have read the Introduction to Java and Java Virtual Machine.

1. How to Install Java on Windows:

Step 1. Go to the link and download JDK(Java Development Kit) for your computer.

how to install java jdk download

You can have multiple versions of JDK installed on your PC but installing the latest version of Java is recommended.

Step 2. After that,

  1. Accept the Licence Agreement.
  2. Click on the download link.

Download_Exe_Java

Step 3. Run the downloaded .exe file to install Java.

Install Java

1.2. Set the Environmental Variable.

You should ask why we have to set these variables because running without environmental variable is like giving the actual path of the Java Tools (javac, java) which is very hectic. So, we need some generic variables in our system.

Step 1. Right-click on My Computer and select the Properties.

Click_On_Properties

Step 2. Click on Advanced system settings.

Advanced_System_Settings

Step 3. Click on Environmental Variables.

Environmental_Varibables

Step 4. Under the System Variables, Click on path field.

Click_On_Path

Step 5. Copy the path of the bin folder where JDK is installed.

In most of the cases, it is installed under C:\Program Files\Java\{jdk-version}\bin

Step 6. Click on the path and click on edit and append/edit in the variable value

Don’t forget to put SEMICOLON before your path.

Set_Path

Step 7. After that,

  1. Exit the Settings.
  2. Press Window + R key.
  3. Type – cmd

Open_CMD

Step 8. Type java

Type_Java

You’ll see Java Option listed in your Command-Line.

CONGRATULATIONS JAVA HAS BEEN INSTALLED

Step 8. We will run our First Java Program in the Next Step.

2. How to Install Java on Mac OS:

Installing Java on macOS in pretty much easier than windows. You need to follow the simple 3 steps.

Step 1. Go to the link and download JDK(Java Development Kit) for your macOS.

Click_On_Download

Step 2. After that,

  1. Accept the Licence Agreement.
  2. Click on the download link.

Download_Java_mac

This time you have to download JDK for macOS (.dmg) file.

Step 3. Click on the downloaded file.

Install_Java_on_mac

Step 4. Click Install, After that Java, will be installed

Java_Successful_Mac

Step 5: Open Terminal, and Type

java –version

I hope you learnt how to install java. Now, after installing Java successfully, learn how to write your first java program.

Leave a Comment