In many cases, you may need to remove java from your computer, such as installing the latest version of java or freeing up space from your machine. Installing Java on Ubuntu is pretty straightforward, but uninstalling it is a hard nut to crack for many folks. In this guide, we will learn how many versions of java are there, what distinguishes them, and how to erase them from your computer completely.
Before erasing java from your device, the first check is to identify what type of java you have on your PC. If you have installed java just to run the java applications, it would most probably “Java Runtime Environment (JRE).” Or, if you have installed java for development purpose, then you may have one of the following:
The difference between “Open JDK” and “Oracle Java” is that the former is open-source, whereas the latter is license-based. Oracle Java is much better when it comes to performance and stability.
Before uninstalling java from your PC, it is essential to know which version of java you have got. To check it launch terminal by pressing “ctrl+alt+t” and type the below-mentioned command:
The above command will also indicate whether the version of java is “Open JDK” or “Oracle JDK.”
Standard output if the version is “OpenJDK”:
Standard output if the version is “Oracle Java”:
If you don’t have any version of java on your machine, the standard output will display it and provide some commands to install it.
Interestingly, you can have more than one versions of java on your device, and you can check and switch any of them by using the command mentioned below:
The above command is displaying the different versions of java I have on my PC. To switch, simply type the number and press “Enter.”
In some cases, it is crucial to identify the method of installation of java. To check it, use the command:
For oracle java use:
The above output will indicate whether the package is installed from an official repository or a third-party repository. The above screenshots are demonstrating that “Oracle Java” is installed using the third-party repository “Linux pricing,” whereas “OpenJDK” is installed using the official Ubuntu repository.
In the above discussion, we learned that there are multiple versions of java; you can have all of them on your PC at a time and conveniently switch them. Various approaches can be used to delete java from ubuntu. To completely erase “OpenJDK,” use:
Or
And to remove oracle java use:
Or
That’s it. Now you can verify it using the command:
Java is one of your PC needs since many applications are developed and published using a java environment. Installing java on ubuntu is a simple procedure, but it is no less than a hassle for many uninstalling since there are multiple versions of java. In this guide, we learned how to identify which version you have on your PC and completely uninstall it.
The rise of Python and security issues has hit the popularity of Java. However still, java is the third most popular language among developers, but for how long nobody knows, the concerns related to its security are still there.
Deploying FreePBX and Asterisk on a single Ubuntu virtual machine in a public cloud is…
Canonical and MediaTek enhance reliability, accelerate market entry and reduce Total Cost of Ownership (TCO)…
As Ubuntu 20.04 LTS (Focal Fossa) standard support ends on May 31, 2025, Azure users…
Welcome to the Ubuntu Weekly Newsletter, Issue 881 for the week of February 23 –…
Welcome back, data scientists! In my previous post, we explored how easy it is to…
In this article, we will see how to install vLLM on Linux using 4 easy…