10

I installed Oracle JDK on Ubuntu 16.04 LTS using the following commands:

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

But I tried various suggestions from the forums and that didn't solve the issue. I purged the ppa and did an update also but it wouldn't remove.

1

1 Answer 1

26

To remove Oracle JDK completely, run the commands given below(one-by-one) from terminal :-

  • Check which JDK packages are installed

    sudo dpkg --list | grep -i jdk

  • Remove Oracle Java 8 completely

    sudo apt-get purge oracle-java8-installer
    sudo apt-get autoremove
    
  • Check that all JDK packages have been removed

    sudo dpkg --list | grep -i jdk

Then if you want to, you can also purge the PPA.

4
  • Are you sure this removes the files from /usr/lib/jvm/jdk? Because I don't think it does. Also, purge will also uninstall, so you don't need to use remove first. See man apt-get | grep purge
    – bmaupin
    Feb 8, 2018 at 19:03
  • I have edited my answer. I think Oracle JDK is removed completely after following the steps given in the answer. If you don't think so, please provide an appropriate solution. Feb 9, 2018 at 9:03
  • 2
    If I put apt remove oracle-java8-jdk, I get The following new packages will be installed: oracle-java7-jdk. But I do not want Java 7. oracle-java8-installer is not available.
    – Timo
    Mar 4, 2018 at 16:42
  • Why does it install another version of Java?
    – chx101
    Apr 7, 2021 at 17:33

Not the answer you're looking for? Browse other questions tagged .