What is Java Development Kit(JDK)? How to download and install the JDK?

In this blog Specifically, we’ll focus on the topics how to download and install the JDK Java Development Kit (JDK) and the Integrated Development Environment (IDE). By the end of this article, you’ll have a clear understanding of how to prepare your computer for Java programming using these tools.

What is Java Development Kit (JDK)?


The Java Development Kit (JDK) is a crucial software package that provides the necessary tools to develop and run Java applications. It includes the Java compiler, runtime environment, and other utilities.

To download and install JDK follow these steps:

  1. Step: Downloading the JDK
  2. Step: Installing the JDK
  3. Step: Configuring Environment Variables
  4. Step: Testing the JDK

1.How to download the JDK?

The JDK can be downloaded from the official Oracle website. Go to the JDK download page and select the appropriate version for your operating system.

Step 1: Downloading the JDK

Visit the official Oracle website

1.Visit the official Oracle website: Go to the official Oracle website (https://www.oracle.com/java/technologies/javase-jdk11-downloads.html) using your web browser.

2.Accept the terms and conditions: On the JDK download page, review and accept the terms and conditions.

download and install JDK

3.Choose the appropriate JDK version: Select the JDK version that matches your operating system. Ensure you select the correct architecture (32-bit or 64-bit) based on your system specifications.

Click on the download link
Downloading the JDK

4.Click on the download link: Click on the download link corresponding to your chosen JDK version. This will initiate the download process.

Step 2: Installing the JDK:

Install the JDK

1.Run the JDK installer: Once the download is complete, locate the downloaded JDK installer file on your system (e.g., jdk-11.0.x_windows-x64_bin.exe for Windows).

download and install JDK installaion wizard

2.Launch the installer: Double-click on the JDK installer file to launch the installation wizard.

download and install JDK installaton path
download and install JDK wizard step

3.Follow the installation wizard: The installation wizard will guide you through the installation process. Follow the prompts and select the desired installation location. The default settings are typically appropriate for most users.

Step:3 Configuring Environment Variables:

1.Set up environment variables: After the installation is complete, you need to configure the environment variables to ensure your system recognizes the JDK installation. This step allows you to access Java tools from any command prompt or terminal window.

download and install JDK env
download and install JDK env adding
download and install JDK env setup
  • Windows:
    • Right-click on “This PC” or “My Computer” and select “Properties.”
    • Click on “Advanced system settings” and navigate to the “Advanced” tab.
    • Click on the “Environment Variables” button.
    • Under the “System variables” section, click “New” to add a new variable.
    • Set the variable name as “JAVA_HOME” (without quotes).
    • Set the variable value as the installation path of the JDK (e.g., C:\Program Files\Java\jdk-11.0.x).
    • Click “OK” to save the variable.
    • In the “System variables” section, locate the “Path” variable and click “Edit.”
    • Add the following entry at the end of the “Variable value” field: %JAVA_HOME%\bin
    • Click “OK” to save the changes.
  • macOS and Linux:
    • Open a terminal window.
    • Type the following command: sudo nano /etc/environment
    • Enter your password if prompted.
    • In the text editor that opens, add the following line at the end: JAVA_HOME=”/path/to/jdk” (replace “/path/to/jdk” with the actual JDK installation path).
    • Press Ctrl+X, then Y, and finally Enter to save the file.
    • Close the terminal window.
download and install JDK java -version

2.Verify the JDK installation: Open a new command prompt or terminal window and type the command “java -version”. If the JDK is properly installed and configured, you should see the Java version information displayed.

Step 4: Testing the JDK:

Certainly! Here’s a basic Java program that prints “Hello, World!” to the console:

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}

To run this program:

  1. Open a text editor and copy the above code into a new file.
  2. Save the file with a .java extension, for example, HelloWorld.java.
  3. Open a command prompt or terminal window and navigate to the directory where you saved the Java file.
  4. Compile the Java program by running the command: javac HelloWorld.java.
  5. If the compilation is successful, a new file named HelloWorld.class will be generated.
  6. Finally, run the program by executing the command: java HelloWorld.
  7. You should see the output “Hello, World!” displayed in the console.

Congratulations! You have successfully written and executed a basic Java program. Feel free to explore further and experiment with more complex code as you continue your Java programming journey.

Congratulations! You have successfully Completed steps for download and install the jdk

Exercise-1

  1. Write a simple Java program: Open a text editor and write a basic Java program, such as printing “Hello, World!” to the console. Save the file with a .java extension (e.g., HelloWorld.java).
  2. Compile the Java program: Open a command prompt or terminal window and navigate to the directory where you saved the Java file. Use the command “javac HelloWorld.java” to compile the program. If there are no errors, a compiled bytecode file (HelloWorld.class) will be generated.
  3. Run the Java program: Execute the compiled program by running the command “java HelloWorld”. You should see the output “Hello, World!” displayed in the console.

If you encountered any difficulties while reading the post, please let us know by clicking here.

Scroll to Top