Oracle Linux: How to Remove Java from a Linux Instance
Applies To:
Linux OS–Version Oracle Linux 7.0 to Oracle Linux 9.0 [Release OL7 to OL9]
Linux x86_64 on Oracle Public Cloud
Goal:
Remove Java versions completely from Oracle Linux instances.
Solution:
To Remove Java package from an Oracle Linux System(other versions of Java may still be present on the system), follow the steps below:
- Find the Java package:
# rpm -qa | grep jdk
- Remove the Java package (retrieved from the previous command output):
Example) # yum remove jdk-11-11.0.18-9.x86_64
- Delete symbolic links with the
update-alternatives
command.
# update-alternatives --remove "java" "/usr/lib/jvm/jdk[version]/bin/java" Examples) # update-alternatives --remove "java" "/usr/lib/jvm/jdk-11-oracle-x64/bin/java" # update-alternatives --remove "javac" "/usr/lib/jvm/jdk-11-oracle-x64/bin/javac" # update-alternatives --remove "javaws" "/usr/lib/jvm/jdk-11-oracle-x64/bin/javaws"
Tagged:
1