Ubuntu:如何完全卸载Java, How to completely uninstall Java?

1、 移除所有 Java相关包 (Sun, Oracle, OpenJDK, IcedTea plugins, GIJ): Remove all the Java related packages (Sun, Oracle, OpenJDK, IcedTea plugins, GIJ):

apt-get update
dpkg-query -W -f='${binary:Package}\n' | 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

 

2、清除配置信息: Purge config files (careful. This command removed libsgutils2-2 and virtualbox config files too):

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

 

3、清除java配置及缓存: Remove Java config and cache directory:

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

 

4、手动清除JVMs:  Remove manually installed JVMs:

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

 

参看:https://askubuntu.com/a/185250

 

本文:Ubuntu:如何完全卸载Java, How to completely uninstall Java?

Leave a Reply