Sunday, 20 October 2024

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

🚀 Master Java & AWS!

Subscribe to Ram N Java for simplified, high-quality tech tutorials!

YES, I WANT TO SUBSCRIBE

How to Uninstall JDK 11 on Linux or Amazon EC2

Cleaning up your development environment is just as important as setting it up! If you need to remove JDK 11 from your Linux machine or Amazon EC2 instance to make room for a newer version, this guide will walk you through the process step-by-step using simple terminal commands.

Step 1: Check Currently Installed Java Versions

Before you start deleting, it's a good idea to see exactly what you have installed. Run the following command in your terminal:

sudo update-alternatives --config java

This will list all Java paths. Take note of the path where JDK 11 is installed (e.g., /usr/lib/jvm/java-11-amazon-corretto).

Step 2: Uninstall Using the Package Manager

If you installed Java using a package manager like yum (common on Amazon Linux/CentOS) or apt (Ubuntu), you can remove it easily:

  • For Amazon Linux/CentOS: sudo yum remove java-11-amazon-corretto-devel
  • For Ubuntu/Debian: sudo apt-get remove openjdk-11-jdk

Step 3: Clean Up Environment Variables

If you manually set up your JAVA_HOME path, you must remove it to avoid errors. Open your profile file:

sudo nano /etc/profile

Find the lines related to JDK 11, delete them, and save. Then, reload the file:

source /etc/profile

Step 4: Verify the Removal

Confirm that JDK 11 is gone by running the version check command:

java -version

If it was your only version, the system will tell you the command is not found. If you have other versions, it will show the next active one.

💡 Need Resources?

Don't forget that I share the PowerPoint presentation and source code for all my tutorials! You can find the download links in the YouTube video description above.

6 comments:

  1. Great Information Provided Thanks For The Information !
    AWS online course in hyderabad

    ReplyDelete

  2. This blog post is incredibly useful and instructive. I want to thank you for sharing this information. I also have a website with a lot of useful information.
    Best java Training institutes in hyderabad

    ReplyDelete
  3. This blog post is incredibly useful and instructive. I want to thank you for sharing this information. I also have a website with a lot of useful information.
    Cyber security training institue in hyderabad




    ReplyDelete
  4. This blog post is incredibly useful and instructive. I want to thank you for sharing this information. I also have a website with a lot of useful information.
    Cyber security training institue in hyderabad




    ReplyDelete
  5. Thank you for sharing this information,its is very helpful to all
    click here for more information

    ReplyDelete

Tutorials