> For the complete documentation index, see [llms.txt](https://muhammad-tri-wibowo.gitbook.io/java-tutorials/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://muhammad-tri-wibowo.gitbook.io/java-tutorials/setting-up-java-development-environment/installing-java-development-kit-jdk.md).

# Installing Java Development Kit (JDK)

#### Installing Java Development Kit (JDK) on Windows:

**Step 1: Download JDK for Windows:**

* Visit the official Oracle website or an authorized distributor.
* Choose the appropriate version for Windows and click on the download link.
* Run the downloaded installer (usually a .exe file).

**Step 2: Run the Installer:**

* Double-click the downloaded .exe file to run the installation wizard.
* Follow the on-screen instructions. You might need administrative privileges to install the JDK.

**Step 3: Set Environment Variables:**

* After installation, set the `JAVA_HOME` environment variable.
  * Right-click on 'This PC' or 'My Computer' and select 'Properties.'
  * Click on 'Advanced system settings.'
  * Click 'Environment Variables.'
  * Under 'System Variables,' click 'New' and add `JAVA_HOME` as the variable name and the JDK installation path as the variable value (e.g., `C:\Program Files\Java\jdk1.8.0_221`).
  * Find the 'Path' variable in the 'System Variables' section and click 'Edit.' Add `%JAVA_HOME%\bin` at the end of the variable value.

**Step 4: Verify Installation:**

* Open Command Prompt and type `java -version`. It should display the installed Java version to confirm the successful installation.

#### Installing Java Development Kit (JDK) on MacOS:

**Step 1: Download JDK for MacOS:**

* Visit the official Oracle website or use a package manager like Homebrew.
* Download the appropriate .dmg file for MacOS.

**Step 2: Run the Installer:**

* Double-click the downloaded .dmg file to mount the disk image.
* Drag the JDK package icon to the Applications folder.
* JDK is now installed on your MacOS.

**Step 3: Set Environment Variables (Optional):**

* MacOS usually sets the necessary environment variables automatically, so manual configuration is often not needed.

**Step 4: Verify Installation:**

* Open Terminal and type `java -version`. It should display the installed Java version to confirm the successful installation.

#### Installing Java Development Kit (JDK) on Linux:

**Step 1: Use Package Manager (Example: Ubuntu):**

* Open Terminal.
* Update the package index: `sudo apt update`
* Install JDK: `sudo apt install default-jdk`

**Step 2: Set Environment Variables (Optional):**

* Linux systems often set environment variables automatically after installation.

**Step 3: Verify Installation:**

* Open Terminal and type `java -version`. It should display the installed Java version to confirm the successful installation.

By following these steps, you can install the Java Development Kit (JDK) on Windows, MacOS, and Linux-based systems, allowing you to develop Java applications on your preferred platform.
