JDK installation and configuration


Friday, December 1, 2023

In this article, you will learn how to set up the Java development environment for Windows, macOS, or Linux systems. You will discover the steps to install the Java Development Kit (JDK) and verify that the Java installation is successful.

This article will help you prepare your system so that you can start developing software harnessing the capabilities of Java. 

Prerequisites

Before configuring the Java development environment on Windows, macOS, or Linux, it is essential to ensure that your system meets some prerequisites.

1. Updated Operating System:

Make sure your system is updated to the latest available version. Keeping your operating system up-to-date is crucial to ensure compatibility and optimal performance with Java development tools.

2. Internet Connection:

An internet connection is necessary to download the Java Development Kit (JDK). Ensure that your connection is stable to avoid interruptions during the download and installation process.

Java Development Kit (JDK) Installation

The Java Development Kit, commonly known as JDK, is an essential component for Java application development.

The JDK provides the necessary tools to compile, run, and debug Java source code. 

Below, we will explain how to download and install JDK 2, the latest Long-Term Support (LTS) version of the Java SE platform that will receive updates under the NFTC until September 2026, one year after the release of the next LTS.

JDK Installation on Windows

Step 1: Download the JDK 21 for Windows from the official Oracle website.

Step 2: Once the installation file is downloaded, run it. The installation wizard will guide you through the process.

Step 3:

Step 4:

Step 5:

Step 6: After completing the installation, verify that the JDK has been installed correctly. To do this, run the following command in the Windows console:

java -version

You should see information about the version of Java you have installed.

JDK Installation on macOS

Once you have downloaded the Java Development Kit (JDK) installer on your Mac system, it's time to proceed with the installation. Follow these steps to complete this process:

1. Running the Installer:

Open the downloads folder or the location where the JDK installation file, usually a DMG file, is saved. Double-click the file to mount it.

2. Starting the Installer:

Once the DMG file is mounted, you'll see a new volume on your desktop containing the installer. Open that volume and look for the file with the ".pkg" or ".dmg" extension corresponding to the JDK. Double-click that file to start the installer.

3. Admin Authentication:

The installer will require you to enter your admin password to proceed. Provide the credentials when prompted.

4. Installation Process:

The JDK installer will guide you through the installation process. Make sure to review the information displayed on the screen and follow the provided instructions.

5. Installation Confirmation:

Once the installation process is complete, you will receive confirmation that the JDK has been successfully installed on your Mac.

6. Checking the Installation:

To verify that the installation was successful, you can open the Terminal and run the following command:

java -version

You should see information about the version of Java you have installed, confirming that the JDK is available and functioning on your system.

JDK Installation on Ubuntu

In Ubuntu, the JDK can be installed through the package management system. Run the following command to install the latest version of the JDK:

sudo apt install default-jdk

Installation Verification

Once the installation is complete, verify that the JDK has been installed correctly. You can do this by running the following command:

java -version

You should see information about the version of Java you have installed, confirming that the installation was successful.

Share it

Share it on your social media and challenge your friends to solve programming problems. Together, we can learn and grow.

Copied

The code has been successfully copied to the clipboard.

More Exercises

Continue improving your Java programming skills with our selection of practical exercises from the lesson. Click on Practice and challenge your knowledge!

1

History of Java

Explore the history of Java, an innovative programming language that revolutionized computing. From its creation in the '90s to its current impact.

2

Java Features

Java is an object-oriented programming language known for several key features

3

JDK installation and configuration

Learn how to install and configure the Java Development Kit (JDK) on Windows, macOS, or Ubuntu (Linux).

4

Compiling and running a Java program

Learn the fundamentals of Java programming, from creating simple programs to running them on the Java virtual machine.

5

Integrated Development Environments (IDEs)

When it comes to programming in Java, having the right tool can make a significant difference in your productivity and ease of development.

6

Hello world!

Write a program in Java that prints Hello world on the screen.

7

Print lines in console

Write a Java program that prints Hello on the first line and your name on the next line.

8

Read user input

Learn how to read user input from the console and perform basic operations with it in Java.

9

Store user input

Create a program in Java that asks the user in the first line What is your name? and save the name in the variable x.

10

Comments

Learn how to use comments in your Java programs to make your code more understandable and maintainable.

Introduction to Java

Know the features of the language and prepare the necessary tools to create the first program with Java.

Fundamentals concepts
Practice exercises

Keep learning

C# Programming Course

Free programming course with practical exercises and solutions in C#. Start learning right now!

Exercises C# App

Take your Exercises C# lessons everywhere with our Android app. Download it now from Google Play