Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 11 Next »

 

On this page:

Remove all the Java related packages

sudo apt-get update

apt-cache search java | awk '{print($1)}' | grep -E -e '^(ia32-)?(sun|oracle)-java' -e '^openjdk-' -e '^icedtea' -e '^(default|gcj)-j(re|dk)' -e '^gcj-(.*)-j(re|dk)' -e 'java-common' | xargs sudo apt-get -y remove

sudo apt-get -y autoremove

Purge config files

After removing all the packages you need to purge all the config files. For that run the following command:

dpkg -l | grep ^rc | awk '{print($2)}' | xargs sudo apt-get -y purge

Remove cache directory

After purging the config files we need to remove Java config and cache directory from your system. Run the following command to remove the cache directory:

sudo bash -c 'ls -d /home/*/.java' | xargs sudo rm -rf

Remove manually installed JVM's

If you have installed any other JVM's then this is the time to remove them. Run the following command:

sudo rm -rf /usr/lib/jvm/*

Remove all leftover Java entries

After uninstalling all the java components from your system some java entries might still be left in your system. To get rid of them run the following command:

for g in ControlPanel java java_vm javaws jcontrol jexec keytool mozilla-javaplugin.so orbd pack200 policytool rmid rmiregistry servertool tnameserv unpack200 appletviewer apt extcheck HtmlConverter idlj jar jarsigner javac javadoc javah javap jconsole jdb jhat jinfo jmap jps jrunscript jsadebugd jstack jstat jstatd native2ascii rmic schemagen serialver wsgen wsimport xjc xulrunner-1.9-javaplugin.so; do sudo update-alternatives --remove-all $g; done

Remove java directories from system

This is the final step in removing Java from your system. After uninstalling the java packages the java directories might still be there in your system. To remove them you need to first find if there are any left. Use the following commands to find any leftover directories:

sudo updatedb

sudo locate -b '\pack200'

If after running the above script you get any output similar to 'jre1.5/bin/pack200' then run the following command (replace jre1.5 with the directory name that you got in the output at the terminal) to remove the leftover java directory:

sudo rm -rf /path/to/jre1.5


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


  • No labels