How ToLinux

How to Uninstall Java in Ubuntu Within Two Minutes

Want to Uninstall Java in Ubuntu? Then we got you covered in this simple tutorial.

Java is an object-oriented programming language developed and launched by Sun Microsystems in 1995. It was the first revolution of the operating systems and most of the programs we use were based on Java. It is available for free to install on all computer operating systems such as Windows, iOS, and Linux (all distros). In Mac and Windows, you can install and uninstall Java easily, but you might need some coding knowledge to install and run Java in any of the Linux operating systems like Ubuntu, Debian, etc.

Ubuntu is the number one operating system among all the Linux OS. It is known that all the Linux distros are open source and 100% free. It is a lightweight OS that can even turn your 10-year-old PC into a faster one. If you have installed Java and wondering how to uninstall it from your computer, we have explained the easiest way to uninstall it completely from the computer.

Follow the below steps and copy paste the commands in your computer to uninstall Java in Ubuntu.

How to Uninstall Java in Ubuntu

It doesn’t matter what Java version and Ubuntu version your computer is running on, you can follow the below steps to uninstall Java from Ubuntu.

1. Open the Terminal app from your Ubuntu launcher.

2. Login to your Ubuntu account by typing the below code and press enter

sudo -i

3. Enter root as username and then type your computer password.

4. Check the Java version installed.

java -version

5. To uninstall Java programs completely, type the codes one by one in the terminal.

sudo update-alternatives --remove-all java
sudo update-alternatives --remove-all javac
sudo update-alternatives --remove-all javaws

6. Now, the final step is to paste the remove command into the terminal and press enter.

sudo rm -rf /usr/lib/jvm/jdk1.8.0
Uninstall Java Ubuntu

7. All your Java programs will be removed from your computer.

8. To verify, run the Java version command and you will get a message stating “No such file or directory.”

check Java version

How to Remove Multiple Versions of Java in Ubuntu

If you have multiple versions of Java, then you can use the below command to remove them one by one.

sudo update-alternatives --remove "java" "/usr/lib/jvm/jdk[version]/bin/[type]"

In the above line of code make sure to replace [version] with your Java version eg: jdk1.9.0

Also, replace [type] field as Java or Javac or Javawas.

Note: Don’t copy-paste the above code as it might not work since you need to replace it with the respective codes as mentioned above.

We are sure that the above codes will work perfectly to uninstall Java in Ubuntu. You can also use the above methods on any Ubuntu-based distros like elementary OS, Zorin OS, Lubuntu, Xubuntu and more to uninstall Java.

Follow Techowns’ Facebook and Twitter pages to stay updated with our guides.

Was this article helpful?
YesNo

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button