SoFunction
Updated on 2025-05-22

A clear and easy-to-understand Java 8 thorough uninstallation and cleaning tutorial

1. Uninstall Java 8 on Windows system

Step 1: Uninstall the program through the control panel

  • PressWin + R, enter, Enter to open "Programs and Functions".
  • Find all names in the list containingJava 8JDK 8orJRE 8entries.
  • Right-click to select one by one and clickuninstall, follow the prompts to complete the uninstallation.

Step 2: Manually delete residual files

  • Open File Explorer and delete the following directories (if they exist):
    C:\Program Files\Java
    C:\Program Files (x86)\Java
    C:\ProgramData\Oracle\Java
    C:\Users\<Your username>\AppData\Local\Java
    

    hint:ProgramDataandAppDataIt is a hidden folder, and you need to check "Hide items" in the "View" menu.

Step 3: Clean up environment variables

  • Right-click "This Computer" → Properties → Advanced System Settings → Environment Variables.
  • Check the following two items and delete Java-related entries:
    • System variables:deleteJAVA_HOME
    • Path variable:delete%JAVA_HOME%\binor similar path.

Step 4: Clean the registry (operate with caution)

  • PressWin + R, enterregedit, Enter to open the registry editor.
  • Backup the registry(File → Export).
  • Delete the following registry key (if it exists):
    HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft
    HKEY_CURRENT_USER\Software\JavaSoft
    

2. Uninstall Java 8 on macOS system

Method 1: Uninstall via terminal

  • Open the Terminal and enter the following command to delete the Java file:
    sudo rm -rf /Library/Java/JavaVirtualMachines/jdk-8*.jdk
    sudo rm -rf /Library/PreferencePanes/
    sudo rm -rf /Library/Internet\ Plug-Ins/
    

Method 2: Check the Java installed by Homebrew

  • If installed via Homebrew, run:
    brew list | grep jdk    # Find Java package name (such as openjdk@8)brew uninstall openjdk@8
    

Step 3: Clean up environment variables

  • Open the configuration file in the user directory (based on the shell used):
    nano ~/.bash_profile    # or ~/.zshrc, ~/.bashrc
  • Delete or comment outJAVA_HOMEandPATHJava-related lines.

3. Linux system uninstall Java 8

Step 1: Uninstall OpenJDK or Oracle JDK

  • Uninstall OpenJDK
    sudo apt-get remove openjdk-8-jdk openjdk-8-jre  # Debian/Ubuntu
    sudo yum remove java-1.8.0-openjdk               # CentOS/RHEL
    
  • Uninstall Oracle JDK
    If you download and install it through the official website, directly delete the installation directory:
    sudo rm -rf /usr/lib/jvm/jdk1.8.0
    

Step 2: Clean up environment variables

  • Check and edit the following files to delete Java-related configurations:
    sudo nano /etc/environment         # Delete JAVA_HOMEsudo nano /etc//   # Delete or comment related lines

4. Verify whether the uninstallation is successful

Run at a terminal or command prompt:

java -version
javac -version

If displayedcommand not foundOr if the Java 8 version is not found, the uninstallation is successful.

Summarize

  • Windows: Uninstall the program → Delete the residual files → Clean up environment variables and registry.
  • macOS: Delete the Java directory → Check Homebrew → Clean the configuration file.
  • Linux: Uninstall the package → Delete the installation directory → Clean up environment variables.

After following the above steps, Java 8 will be completely cleaned up and will not affect the installation of other versions.

This is the article about Java 8 thorough uninstallation and cleaning. For more information about Java 8 thorough uninstallation and cleaning, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!