How to uninstall Java for LInux

java

If the native Java for Linux has been installed and the goal is to remove it from the system and install the Oracle Java JDK. Here are the steps to do just that. This is here for reference, I have not fully tested this, in that the installation I was verifying did not have JRE as indicated in the original Java source, rather found Java. In which case, the removal was not successful as there were dependencies.

Note: If you have RPM on your Linux box, you should first find out if Java is already installed using RPM. If Java is not installed using RPM, you should skip reading.

  • Open Terminal Window
  • Login as the super user
  • Try to find jre package by typing: rpm -qa | grep jre
  • If RPM reports a package similar to jre-<version>-fcs, then Java is installed with RPM.
  • Try to find java package by typing: rpm -qa | grep java
  • If RPM reports a package similar to java-1.4.2-gcj-compat-1.4.2.0-40jpp.115, then Java is installed with RPM.

Note: Normally, you do not need to uninstall Java with RPM, because RPM is able to uninstall the old version of Java when installing a new version! You may skip reading, unless you want to remove Java permanently.

  • To uninstall Java, type: rpm -e jre-<version>-fcs
  • To uninstall java, type: rpm -e java-1.4.2-gcj-compat-1.4.2.0-40jpp.115

Source(s)
http://www.java.com/en/download/help/linux_uninstall.xml