If you want to remove completely that java version you need to remove the packages that contain it, see a list of packages with:
sudo dpkg --get-selections | grep jre
In this way you see what jre
packages you've installed. Then you can remove the packages with:
sudo apt-get remove old_jre_package
Anyway a better solution is to make more JDK
versions coesist, in Ubuntu is easy to do it. You can use the update-alternatives
command. So you can install another JDK
and switch between the jdk
versions with the alternative tools:
sudo update-alternatives --config java
sudo update-alternatives --config javac
For more options see the man page man update-alternatives
.