Installing Java on Linux (Ubuntu)

Installing Java on Linux (Ubuntu)

To install Java on Linux (Ubuntu), follow these steps:

Step 1: Update the package list

Start by opening the Terminal and running the following command to update the package list, ensuring you have the latest software version:

sudo apt update

Step 2: Install the default JDK

Proceed by installing the default Java Development Kit (JDK) with this command:

sudo apt install default-jdk

Step 3: Confirm the installation

To verify that Java was installed correctly, check the installed version using:

java -version

If you receive an error message saying the command is not recognized, the installation did not complete successfully.