How to uninstall java in ubuntu?

by georgiana.senger , in category: General Help , 2 years ago

How to uninstall java in ubuntu?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

by coty_beier , 2 years 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."

Member

by adolf , a year ago

@georgiana.senger 

Please keep in mind that these instructions are specific to removing Java using the package manager in Ubuntu. If you have manually installed Java or installed it from another source, the steps may vary.


If you find that Java is still installed on your system after following these steps, you may need to manually remove any remaining Java directories and files. This can be done by navigating to the Java installation directories (such as /usr/lib/jvm/) and deleting them. However, be cautious when deleting files manually as it can impact other applications or system functionality.


It is also worth noting that removing Java may affect any applications or programs that rely on Java. So, make sure to verify that the removal of Java does not negatively impact any software you need to use.