Sunday, 20 October 2024

Uninstalling JDK 17 on Linux OS (Amazon EC2 Cloud) | How to Uninstall JDK 17 on Linux (Amazon EC2)

🚀 Become an AWS & Java Pro!

Subscribe to Ram N Java for simplified, expert-led tech tutorials!

SUBSCRIBE TO MY CHANNEL

How to Uninstall JDK 17 on Linux & Amazon EC2

Managing software versions on a server is a critical skill for any developer or cloud engineer. If you need to remove JDK 17 from your Linux machine or an Amazon EC2 instance, this tutorial will guide you through the process quickly and safely.

Step 1: Check Your Installed Java Version

First, confirm that JDK 17 is the version currently active on your system. Run the following command in your terminal:

java -version

If you have multiple versions, you can see all paths using: sudo update-alternatives --config java.

Step 2: Uninstall the JDK Package

Depending on how you installed JDK 17, use the appropriate package manager command to remove it:

  • For Amazon Linux/CentOS (YUM): sudo yum remove java-17-amazon-corretto-devel
  • For Ubuntu/Debian (APT): sudo apt-get remove openjdk-17-jdk

Step 3: Remove Leftover Environment Variables

It's important to clean up your configuration files to prevent path errors later. Open your profile settings:

sudo nano /etc/profile

Locate any lines that set JAVA_HOME to the JDK 17 path, delete them, save the file, and then refresh your environment:

source /etc/profile

Step 4: Verify the Uninstallation

Finally, run the version check once more to ensure JDK 17 has been successfully removed:

java -version

💡 Pro Tip for Cloud Learners:

I always share the PowerPoint presentation and source code used in my videos! You can find the direct download links in the YouTube video description above.

No comments:

Post a Comment

Tutorials