31

I am using Redhat 6, I was working with java 1.6 because I had a requirement to work with java 1.6. I update my redhat using yum uppdate and openjdk 1.8 got automatically installed. I tried to remove openjdk using

yum remove java*

java 1.6 got remove but not openjdk.

and then I tried yum remove openjdk* this dint work. I tried to remove from UI but from there I am able to list openjdk 1.8 but not getting the option to remove it.
How do I completely remove openjdk.

2 Answers 2

65

First Find java product and version using below command:

rpm -qa | grep java

And

rpm -qa | grep jdk

OUTPUT like:

jdk1.7.0

Then remove package using RPM or YUM:

yum remove jdk1.7.0

or

rpm -e jdk1.7.0

2
  • 2
    I'm trying to do this on Fedora 25. But instead of removing just the OpenJDK java installation it appears that it wants to remove all java packages that are dependent on this? Every time it asks me to remove 75+ other packages. It's not good, because I want to install Oracle Java instead and don't want to re-install all the other packages..?
    – Muppet
    Apr 29, 2017 at 21:02
  • It is always recommend using yum vs. rpm, because rpm commands can rip things out of the rpm database without caring about dependencies. yum will print warnings and show everything it is removing Apr 15, 2021 at 17:08
12
rpm -qa | grep openjdk | xargs  yum -y remove

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.