Visit Azul.com Support

Uninstall other OpenJDK distributions

When you install a (newer) version of Azul Zulu, it’s not required to remove other installations of Azul Zulu or other distributions. Different versions can exist on your system next to each other, and you can use them independently. SDKMAN, for instance, is a tool that can assist you in this and is used by many developers to easily switch between different Java versions during development and/or testing.

But if you want to keep your system "clean", it can be a good idea to remove the installations you are no longer using. To remove Azul Zulu distributions, use the guidelines provided for:

Finding All Installed Java Versions with JavaFinder

JavaFinder is a little command line tool to find all Java installations in a given path (incl. subfolders). This can be useful if you need to figure out what kind of distribution(s) you have installed on your machine. It should find builds of OpenJDK and GraalVM of all distributors.

The sources and binaries of this tool are available on GitHub.

If you run JavaFinder without any parameter, it will scan the following predefined paths:

  • Windows: C:\Program Files\Java\

  • Linux : /usr/lib/jvm

  • MacOS : /System/Volumes/Data/Library/Java/JavaVirtualMachines/

You can adjust this with the following parameters:

  • -h: show some info

  • -v: show the version number

  • csv /PATH: output the result in csv format, starting from the given path

  • json /PATH: output the result in json with beautified formatting, starting from the given path

  • If no output format is specified, json (not beautified) is used

For example:

 
% ./javafinder json ~/.sdkman/ { "timestamp":1686139381, "search_path":"/Users/test/.sdkman/", "sysinfo":{ "operating_system":"Mac OS", "architecture":"ARM64", "bit":"64 Bit" }, "distributions": [ { "vendor":"Azul", "name":"Zulu", "version":"19.0.1", "timestamp":1686139381, "path":"/Users/test/.sdkman/candidates/java/19.0.1.fx-zulu/zulu-19.jdk/Contents/Home/", "build_scope":"OpenJDK", "in_use":false, "used_by":[] }, ... ] }

Guidelines to Remove Other Distributions of OpenJDK

Windows

During installation of Java, new keys are added to the Windows Registry. For a complete clean-up, it can be necessary to search in the registry and remove the unneeded versions.

A few examples of keys used in the Windows Registry, depending on the version:

 
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\JRE HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\JRE\9 HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.8 HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\8.0.282 HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\JavaSoft\Java Runtime Environment\1.8.0_371

macOS and Linux

Depending on your software packaging and deployment system, different commands can be used on macOS and Linux.

Brew

 
# Check all the installed packages % brew list # Uninstall example, depending on the installed package, for example 'openjdk' % brew uninstall --formulae openjdk

Apt

 
# Check all the installed packages $ sudo apt list --installed # Uninstall example, depending on the installed package, for example 'openjdk-17-jre' $ sudo apt remove openjdk-17-jre # To remove the package including all its files and configuration files, instead use $ sudo apt purge openjdk-17-jre # To remove that were installed as dependencies but are no longer needed $ sudo apt autoremove

Yum

 
# Check all the installed packages $ yum list installed java* # Uninstall example, depending on the installed package, for example 'java-1.8.0-openjdk' $ sudo yum remove java-1.8.0-openjdk # Uninstall example, depending on the installed packages, for multiple packages $ sudo yum remove java-1.8.0-openjdk java-11-openjdk

Rpm

 
# Check all the installed packages $ rpm -qa | grep java # Uninstall example, depending on the installed package, for example 'java-1.8.0-openjdk' $ sudo rpm -e java-1.8.0-openjdk # Uninstall example, depending on the installed packages, for multiple packages $ sudo rpm -e java-1.8.0-openjdk java-11-openjdk

Using SDKMAN

Follow these steps to uninstall Java versions with SDKMAN:

  1. Open a terminal or command prompt.

  2. Run the following command:

     
    sdk uninstall java {version}

    For instance, to remove 17.0.5-oracle:

     
    sdk uninstall java 17.0.5-oracle
  3. To remove all installed versions of Java, run the command:

     
    sdk uninstall java
  4. Verify the (un)installed versions with the command:

     
    sdk list java
  5. You can check the versions that are installed by SDKMAN in the directory:

     
    ~/.sdkman/candidates/java/