🎯 Master Java Development!
Never miss a tutorial. Subscribe to Ram N Java for professional coding guides!
SUBSCRIBE TO THE CHANNELHow to Cleanly Uninstall JDK from Linux
Sometimes you need to clear out old versions of Java to make room for a new update or simply to clean up your system. Removing JDK from Linux might seem intimidating at first, but with a few simple terminal commands, you can ensure a clean uninstallation without leaving any mess behind.
Step 1: Identify Installed Java Versions
Before you delete anything, you need to know what you have. Open your terminal and check the current Java version with java -version. You can also list all installed Java packages using your system's package manager to ensure you target the right version.
Step 2: Use the Package Manager to Remove
If you installed Java using a package manager like APT (for Ubuntu/Debian) or YUM (for RHEL/CentOS), the removal is straightforward. Simply use the remove or purge command followed by the package name. This will handle the binary files and most configuration links automatically.
Step 3: Manually Removing Tarball Installations
If you installed Java manually by extracting a .tar.gz file, you will need to delete the folder manually. Navigate to the directory where you stored the JDK (common locations include /usr/lib/jvm/ or /opt/) and use the rm -rf command on the specific JDK folder.
Step 4: Cleaning Up Environment Variables
After removing the files, don't forget your environment variables! Open your .bashrc, .bash_profile, or /etc/environment file and remove any lines referring to JAVA_HOME or entries in the PATH that point to the deleted JDK directory.
Step 5: Verify Removal
Restart your terminal and type java -version. If the uninstallation was successful, your system should either show another installed version or return a message saying the command was not found. Your system is now clean!
Click here to watch in Youtube :
https://www.youtube.com/watch?v=5gOfLZCW260&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
![]() |
| Java Tutorial : Uninstall JDK (Linux Operating System) |
![]() |
| Java Tutorial : Uninstall JDK (Linux Operating System) |
![]() |
| Java Tutorial : Uninstall JDK (Linux Operating System) |
![]() |
| Java Tutorial : Uninstall JDK (Linux Operating System) |
![]() |
| Java Tutorial : Uninstall JDK (Linux Operating System) |
![]() |
| Java Tutorial : Uninstall JDK (Linux Operating System) |
![]() |
| Java Tutorial : Uninstall JDK (Linux Operating System) |
#Which java #java –version #rpm –qa | grep jdk #rpm -e <package_name> #rpm







No comments:
Post a Comment