Install JDK

To start programming in Java, you need to install the Java Development Kit (JDK)

 

Step by Step Guide

Download the JDK

Install the JDK

Windows

  • Run the downloaded installer and follow the prompts to install the JDK.
  • During installation, note the installation path (e.g., C:\Program Files\Java\jdk-11.0.10).

macOS

  • Open the .dmg file and follow the prompts to install the JDK.

Linux

  • Use package managers like apt or yum to install OpenJDK. For example, on Ubuntu, run in the terminal:
sudo apt update
sudo apt install openjdk-11-jdk

Set Up Environment Variables (Windows Only)

  • Right-click on This PC or Computer and select Properties.
  • Click on Advanced system settings, then on Environment Variables.
  • In the System variables section, click New and add:
    • Variable name: JAVA_HOME
    • Variable value: Path to your JDK installation (e.g., C:\Program Files\Java\jdk-11.0.10).
  • Find the Path variable, select it, and click Edit. Add a new entry:
    • %JAVA_HOME%\bin
  • Click OK to save changes.

Verify the Installation

  • Open a command prompt (Windows) or terminal (macOS/Linux) and run:
java -version
  • You should see the installed JDK version displayed.
Last updated on