# 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://muhammad-tri-wibowo.gitbook.io/java-tutorials/setting-up-java-development-environment/installing-java-development-kit-jdk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
