Fouled up my openjdk-8-jre

Ubuntu 16.04. I was trying to run pycharm, and realized that I must have corrupted my jre at some point. Even after doing:

sudo apt purge openjdk-8-jre

running java -version gives me:

nick@imipramine:~$ java -version
openjdk version "9-internal"
OpenJDK Runtime Environment (build 9-internal+0-2016-04-14-195246.buildd.src)
OpenJDK 64-Bit Server VM (build 9-internal+0-2016-04-14-195246.buildd.src, mixed mode)

How can I completely remove all Java jres and jdks from my system before re-installing? Or am I missing something super basic?

BTW, I tried:

apt purge openjdk-9-internal
apt purge openjdk-9-jre openjdk-9-jdk

And openjdk-8-jdk.

Some files were removed, but java -version still reports that openjdk is installed!


Assuming you did not build OpenJDK from source, this will uninstall any package starting with openjdk:

sudo apt remove --purge "^openjdk.*"

Including any program depending on a Java runtime environment.