Debian – How to remove Java in Debian

debianjavauninstall

java -version
java version "1.6.0_18"
OpenJDK Runtime Environment (IcedTea6 1.8.13) (6b18-1.8.13-0+squeeze2)
OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)

There doesn't seem to be an easy way to search for packages in apt so I'm using dpkg to search for java-related packages:

# dpkg --get-selections | less | grep java
ca-certificates-java            install
java-common                     install
javascript-common               install
libaccess-bridge-java           install
libaccess-bridge-java-jni       install
libdb4.7-java-gcj               deinstall
libhsqldb-java-gcj              deinstall
sun-java6-bin                   deinstall
sun-java6-jre                   deinstall
tzdata-java                     install

I proceed to remove java-common, however when it finishes java is still installed and java -version still shows the same thing.

Nothing changes, the java-common package even still appears in the dpkg search. What am I missing?

I also removed OpenJDK, which seemed to set it to "deinstall":

# dpkg --get-selections | less | grep openjdk
openjdk-6-jre                   deinstall
openjdk-6-jre-headless          install
openjdk-6-jre-lib               install

Java is still there.

# java -version
java version "1.6.0_18"
OpenJDK Runtime Environment (IcedTea6 1.8.13) (6b18-1.8.13-0+squeeze2)
OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)

Best Answer

For me it was:

sudo apt-get remove openjdk-6*
sudo apt-get remove icedtea*
Related Question