Where do I find the JDK install to uninstall? @terdon had explained using an rpm type download so it would be easier to uninstall, but I cannot find it.
4 Answers
What's that packages name?
When you don't know the name of a specific RPM to uninstall you can search for it like so using the command rpm.
$ rpm -aq | grep -i jdk
java-1.7.0-openjdk-devel-1.7.0.60-2.4.4.0.fc19.x86_64
jdk-1.7.0_45-fcs.x86_64
java-1.7.0-openjdk-1.7.0.60-2.4.4.0.fc19.x86_64
Based on the above output I have 2 versions of Java installed. The official Oracler version, jdk-1.7.0_45 and the IceTea version aka. Open JDK, java-1.7.0-openjdk-1.7.0.60-2.4.4.0.
Uninstalling
To uninstall the official version of Java (JDK) you could use the following commands, yum or rpm:
yum
$ sudo yum remove jdk
[sudo] password for saml:
Loaded plugins: auto-update-debuginfo, changelog, langpacks, refresh-packagekit
Resolving Dependencies
--> Running transaction check
---> Package jdk.x86_64 2000:1.7.0_45-fcs will be erased
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================
Removing:
jdk x86_64 2000:1.7.0_45-fcs installed 193 M
Transaction Summary
=====================================================================================================================
Remove 1 Package
Installed size: 193 M
...
rpm
$ sudo rpm -e jdk
I would recommend always trying to use yum if you can, it does dependency checks that rpm does not.
- 363,520
- 117
- 767
- 871
-
I can't wget http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.rpm – cea Jan 23 '14 at 04:30
-
Yes you have to go in through their website and download the files via your browser. Then use `scp` to copy them to other servers that are headless. – slm Jan 23 '14 at 04:31
Search pre-installed JAVA:
$ rpm -qa | grep java
javapackages-tools-3.4.1-11.el7.noarch
java-1.8.0-openjdk-headless-1.8.0.151-5.b12.el7_4.x86_64
Remove using following command:
rpm -e java-1.8.0-openjdk-headless-1.8.0.151-5.b12.el7_4.x86_64
rpm -e javapackages-tools-3.4.1-11.el7.noarch
- 121
- 2
yum remove java
It is working for me
-> rpm -qa | grep java java-1.8.0-openjdk-1.8.0.312.b02-0.1.ea.el8.x86_64 tzdata-java-2021b-1.el8.noarch javapackages-filesystem-5.3.0-1.module_el8.0.0+11+5b8c10bd.noarch java-1.8.0-openjdk-headless-1.8.0.312.b02-0.1.ea.el8.x86_64
-> sudo yum remove jna-4.5.1-5.el8.x86_64 java-1.8.0-openjdk-headless-1:1.8.0.312.b02-0.1.ea.el8.x86_64
-
Welcome to the site, and thank you for your contribution. Please note that [brevity is acceptable, but fuller explanations are better](https://unix.stackexchange.com/help/how-to-answer). Currently, it is extremely difficult to understand how your answer relates to the original problem; please consider expanding it. – AdminBee Oct 26 '21 at 08:39