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.
How
to check the type of Java on Linux (Ubuntu):
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:
- Open JDK
- Oracle Java
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.
How to identify the Java version on Linux (Ubuntu):
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.
How to switch versions of Java on Linux (Ubuntu):
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.”
How to check the installation method of Java on Linux (Ubuntu):
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.
How to uninstall Java from Linux (Ubuntu):
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:
Conclusion:
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.
Discover more from Ubuntu-Server.com
Subscribe to get the latest posts sent to your email.