Ubuntu – How to uninstall oracle java 8 and install oracle java 7 instead with webupd8 installer

javaoraclesoftware installationuninstall

I installed oracle java 8 by typing in terminal:

sudo add-apt-repository ppa:webupd8team/java  
sudo apt-get update
sudo apt-get install oracle-java8-installer

but now I want to uninstall oracle java 8 and install oracle java 7 instead with sudo apt-get install oracle-java7-installer

how can I uninstall java 8? which commands should I type in terminal?

Best Answer

Try with this code in terminal to remove java 8:

sudo apt-get purge oracle-java8-installer

Then type:

javac -version

The output must be:

javac: command not found

and to install java 7 in Ubuntu I use this code in terminal:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

After that type the following to see if there is java installed:

java -version

The output must be:

java version "1.7.0_80"