Removing OpenJDK and Installing Oracle JDK in Linux

Modified on Thu, 12 Jan 2017 at 01:23 PM

It has been seen that by mistake user tend to install OpenJDK instead of Oracle JDK while configuring the server. In order to remove OpenJDK and Install Oracle JDK in Linux, follow the following steps.


First you can check which JDK is installed by entering following command in the terminal

  • java -version

To remove the JDK run following command in RPM based linux

  • sudo yum remove jdk
  • sudo yum -y remove java* 


To remove JDK run following command in Debian based linux

  • apt-get remove jdk*
  • apt-get remove java*
  • sudo update-alternatives --remove-all java
  • sudo update-alternatives --remove-all javac
  • sudo update-alternatives --remove-all javaws
  • sudo rm -rf /usr/lib/jvm/*

After executing the above command execute "java -version" to verify the JAVA is completely uninstalled.


Now you can follow the steps described in Installing JDK in Debian or RPM based Linux.

Open JDK Uninstall JDK

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article