How to uninstall java in ubuntu?

by georgiana.senger , in category: General Help , 7 months ago

How to uninstall java in ubuntu?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by coty_beier , 2 months ago

@georgiana.senger 

To uninstall Java on Ubuntu, follow these steps:

  1. Open a terminal by pressing Ctrl+Alt+T on your keyboard.
  2. Type the following command to check if Java is installed on your system:
1
java -version


If Java is installed, you will see the version number of the Java installation. If you don't see any output, then Java is not installed on your system.

  1. To uninstall Java, you need to use the apt-get command to remove the Java package. Type the following command to remove the default Java installation:
1
sudo apt-get remove openjdk-11-jre-headless


This command will remove the Java runtime environment (JRE) from your system, but it will not remove the Java Development Kit (JDK) if you have it installed.

  1. To completely remove Java, including the JDK, type the following command:
1
sudo apt-get purge openjdk*


This command will remove all Java-related packages from your system.

  1. Once the Java packages are removed, you can verify that Java is no longer installed on your system by typing the following command:
1
java -version


If Java is no longer installed, you will see an error message that says "command not found."