Try this command:
java -version
If 1.6* comes then try:
sudo apt-get autoremove openjdk-6-jre
If 1.7* comes then try:
sudo apt-get autoremove openjdk-7-jre
Assuming that you don't have jdk in your system. If you have use this command:
sudo apt-get autoremove openjdk-"<version>"-jdk
replace with the version like we did it in previous example.
Reference:
[1] http://askubuntu.com/questions/84483/how-to-completely-uninstall-java
[2] http://www.cnblogs.com/bluestorm/p/5677625.html