Categories: Ubuntu

How to Uninstall Java from Ubuntu 22.04

JAVA is the programming language used in most mobile and web applications for a long time, and also many famous companies are using it for the purpose of developing software. In this blog, we will explore the method of uninstalling the Java package from Ubuntu using the command-line interface.

How to uninstall Java from Ubuntu

To uninstall the package of Java from Ubuntu, we will first confirm that it is being installed or not, for which there are two different commands, first one is to list down all the installed packages and then filter out only the packages that include java using the grep command:

Sponsored
$ sudo apt list –installed | grep java

Another way to confirm the installation of Java is by displaying the installed version of Java by running the command:

$ java –version

Now, we will find out the location of the java packages on Ubuntu. Commonly they are present either in the /opt/ directory or in the /usr/lib/ directory which can be found out by hit and trial methods. In our Ubuntu machine, it is being stored in ls /usr/lib/jvm that can be listed down by running the command:

$ ls /usr/lib/jvm

As we can see that all the packages and configuration files are located in this directory so we will remove the directory of jvm using the command:

Sponsored
$ sudo rm -r /usr/lib/jvm

To confirm the uninstallation of the java, we will display the version of Java using the command:

$ java –version

The output is the confirmation that there is no package of Java installed anymore.

Conclusion

To uninstall the Java package from Ubuntu 22.04, we will run the command “sudo rm -r /usr/lib/jvm ” after confirming the directory of jvm.  In this write-up, the method of uninstalling Ubuntu has been explained in detail.

Ubuntu Server Admin

Recent Posts

Cut data center energy costs with bare metal automation

Data centers are popping up everywhere. With the rapid growth of AI, cloud services, streaming…

24 hours ago

Build the future of *craft: announcing Starcraft Bounties!

Our commitment to building a thriving open source community is stronger than ever. We believe…

24 hours ago

NodeJS 18 LTS EOL extended from April 2025 to May 2032 on Ubuntu

The clock was ticking: Node.js 18’s upstream End of Life (EOL) The OpenJS Foundation is…

24 hours ago

Native integration now available for Pure Storage and Canonical LXD

June 25th, 2025 – Canonical, the company behind Ubuntu, and Pure Storage, the IT pioneer…

2 days ago

Revolutionizing Web Page Creation: How Structured Content is Slashing Design and Development Time

Co-authored with Julie Muzina A year ago, during our Madrid Engineering Sprint, we challenged ourselves…

3 days ago

Ubuntu Weekly Newsletter Issue 897

Welcome to the Ubuntu Weekly Newsletter, Issue 897 for the week of June 15 –…

4 days ago