| by Arround The Web | No comments

How to Install OpenJDK on Linux Mint 21

Java is a programming language used for the development of Web & Application servers, Android apps, desktop Applications, and games. You can also use Java on your Linux Mint system for the developments of different applications. You can follow the article below to know how to install an open-source Java development kit (JDK) on Linux Mint.

How to Install OpenJDK on Linux Mint 21

To install open-source Java development kit you can use the methods mentioned below:

Installing OpenJDK Through Software Manager – Linux Mint

You can install an open-source java development kit by using the software manager of Linux Mint. To complete the installation, open the software manager, search for jdk, select the latest version as it has various versions available and click on the Install button:

Installing OpenJDK Through Terminal – Linux Mint

You can also install OpenJDK by using the Linux Mint. You can follow the steps mentioned below to install the OpenJDK using terminal:

Step 1: List down all the version of OpenJDK available on the Linux Mint executing the command given below:

$ apt-cache search openjdk

 

Step 2: To install the default version of OpenJDK on your system execute the command mentioned below:

$ sudo apt install default-jdk

 

Step 3: You can install a specific version by using the syntax given in the command mentioned below:

$ sudo apt install openjdk-<version>-jdk

 

For demonstration i have installed the latest version of OpenJDK that is 19 by using the above given syntax:

$ sudo apt install openjdk-19-jdk

 

Step 4: After the successful installation of the OpenJDK you can check its version by running the command mentioned below:

$ java --version

 

Step 5: You can set the desired version as default version so to do this first you can list all the OpenJDK versions installed on Linux Mint by running the command mentioned below:

$ sudo update-java-alternatives --list

 

Step 6: Now execute the below command and you will get the option to set the desired version to set as default:

$ sudo update-alternatives --config java

 

Now enter the respective number of the OpenJDK version you want to set as a default like if want to set OpenJDK 19 as default so I can either enter 3:

How to Uninstall OpenJDK on Linux Mint 21

You can uninstall the OpenJDK by using the following methods:

Through Software Manager

To remove the OpenJDK from your system you can just open software manager, search for OpenJDK and click on button mentioning Remove:

Through Terminal

To remove the OpenJDK from your system using terminal you can execute the command given below:

$ sudo apt remove --autoremove openjdk-19-jdk

 

Conclusion

Java is a famous language used for the development of various kinds of applications. This language is also compatible with Linux Mint and you can install open-source java development kit by using software manager and apt package manager as well by using the guide mentioned in the above article.

Share Button

Source: linuxhint.com

Leave a Reply