Skip to content

1.2. Installing JDK

To develop Java applications, you need to install the Java Development Kit (JDK). Follow the steps below to install and configure the JDK on your system.

Step 1: Download the JDK

  1. Go to the Oracle JDK Downloads page.
  2. Select the appropriate JDK version for your operating system and architecture (e.g., Windows x64, macOS, or Linux).
  3. Download the installer file.

Step 2: Install the JDK

  1. Locate the downloaded installer file and run it.
  2. Follow the on-screen instructions to complete the installation process.
  3. Take note of the installation directory (e.g., C:\Program Files\Java\jdk-XX), as it will be needed later.

Step 3: Configure Environment Variables

To ensure your system recognizes the JDK, you need to set up environment variables:

  1. Open your system's environment variable settings:
    • Windows: Search for "Environment Variables" in the Start menu.
    • macOS/Linux: Edit the shell configuration file (e.g., .bashrc, .zshrc, or .bash_profile).
  2. Add a new environment variable:
    • Variable Name: JAVA_HOME
    • Variable Value: The path to your JDK installation directory (e.g., C:\Program Files\Java\jdk-XX).
  3. Update the PATH variable:
    • Append the bin directory inside the JDK folder to the PATH variable (e.g., C:\Program Files\Java\jdk-XX\bin).

Step 4: Verify the Installation

  1. Open a terminal or command prompt.
  2. Run the following command:
    bash
    java -version
  3. If the installation was successful, the terminal will display the installed JDK version.