How to Install Java on Linux Mint

When you want to build and run Java applications on Linux Mint you must have Java installed. The beauty of Java is that it allows you to create applications and software that can run on any platform. Additionally, you can define which JDK version you want to use for your project and specify it when you install Java.

Our guide today focuses on installing Java on Linux Mint. We will detail the step-by-step guide that you should follow to quickly install OpenJDK and JRE on Linux Mint. read on!

Installing Java on Linux Mint

When you want to install Java, there are two options you can choose from. First, you can opt for Oracle Java which comes with a commercial license that you have to pay to use. This option works primarily with enterprises. Alternatively, you can focus on OpenJDK which is free and open-source. For this guide, we will be working with OpenJDK.

Here are the steps to install OpenJDK on Linux Mint.

Step 1: Update and Upgrade

For seamless installation, you should first update and upgrade the repositories to ensure that all repositories are up to date. For that, use the following command:

, sudo apt update , sudo appropriate upgrades

Step 2: Check if Java is installed

Sometimes, you may find that you already have Java installed. However, the installed version may not be the one you want to use for your project.

Check the Java version to confirm whether Java is already installed on your system.

The following output shows that we already have OpenJDK 11 installed. Your case may be different. Nonetheless, we will proceed with the steps and install a different OpenJDK version.

Step 3: Install JRE

To run Java-based applications, you must have the Java Runtime Environment (JRE). Even if you don't need to do the coding part but you want to run Java-based applications, you should have JRE running on your Linux Mint.

Luckily, you can install it with the following simple command:

, sudo apart to install default-jre

Here, we set the JRE to install the default version, not any specific version. We can see that JRE is already installed on our system. If you don't have it installed, running the previous command will install it immediately, and you can proceed with the installation steps.

Step 4: Install OpenJDK

The last step to install Java on Ubuntu is to install OpenJDK. Here, you can use the default OpenJDK or specify the version you want to install. In our case, we discovered that we already have OpenJDK 11. So, let's install OpenJDK-17.

For that, our installation command will proceed as follows:

, sudo apart to install openjdk-17-JDK

Once you press “y”, the installation will begin, and Java will be installed on your Linux Mint.

To confirm that Java is successfully installed on your Linux Mint, double-check its version. If you have selected OpenJDK-17, as we have done in this post, you will get an output like the following. If you choose a different version, it will be reflected on your terminal output.

You now have Java on Linux Mint and you can start using it to build your project. You only need an IDE, such as Eclipse, to write your code.


Java is a powerful programming language for developing desktop, web, and mobile apps. There are many uses and applications that require Java. To get started with Java, you need to know how to install it on your system first. This blog focuses on installing Java on Linux Mint. We explained in detail the steps to follow and explained each one in detail. With this, you now have Java installed on Linux Mint.

Add comment

By Ranjan