If you create your own applications for Mac or just enjoy tinkering with code in different environments, you may have experimented with different implementations of Java. If you’ve installed one or more of them and no longer use them, it’s a good idea to uninstall them to free up space and prevent possible conflicts with other files on your Mac in the future. In this article, we’ll show you how to uninstall OpenJDK on your Mac.

What is OpenJDK?

OpenJDK is an open source version of the Java Development Kit. It’s used to create Java applications and is available on several platforms, including macOS, Windows, and Linux. Once created, Java apps are platform-agnostic and can run on any machine that has a Java runtime environment installed. OpenJDK was first released by Sun Microsystems and has been worked on since by several organizations, such as Oracle, Apple, and IBM, as well as thousands of smaller developers.

Why uninstall OpenJDK?

The main reason for uninstalling OpenJDK is that you no longer use it — either because you no longer need to develop Java apps or because you use a different development environment. As with any software you install and don’t use, it’s good practice to uninstall it to free up space and prevent possible conflicts with other files in the future. Old unused software can also make your Mac more vulnerable to malware attacks because you are much less likely to keep it updated and, therefore, any security flaws in it will never be patched.

How to uninstall any application easily

When it comes to uninstalling applications completely on your Mac, you need to remove every file and folder the application has created. If the application comes with its own uninstaller, that’s not a difficult job. But if it doesn’t, you need to track all these files and folders down manually and drag them to the Trash. Unless you use a dedicated uninstaller tool. CleanMyMac’s Applications tool, for example, can uninstall any application completely with just a couple of clicks. You can even uninstall multiple apps at the same time. It can also remove files left over by applications that weren’t uninstalled properly and reset applications that are misbehaving. And it will check for updates for all the applications installed on your Mac and allow you to update them all at the same time. Get your free CleanMyMac trial and check out how the Applications tool works.

How to uninstall OpenJDK on your Mac

In order to uninstall OpenJDK, you need to locate its files in your Mac’s Library folder and drag them to the Trash. Note that the folder you need is the main Library folder, not your user Library folder that sits in your Home directory. Here’s how to find it and uninstall OpenJDK:

  1. Click the Finder in the Dock and then navigate to the Go menu.
  2. Choose Go to Folder.
  3. Paste this path in the text box and press Return: /Library/Java/JavaVirtualMachines
  4. Look for the OpenJDK folder and drag it to the Trash.
  5. Empty the Trash.

How to uninstall OpenJDK using Terminal

  1. Open Terminal.
  2. Type this command followed by Return: cd /Library/Java/JavaVirtualMachines
  3. Type the following, replacing [name of OpenJDK folder] with the name of the OpenJDK folder:
    sudo rm -rf [name of OpenJDK folder]
  4. Press Return.
  5. Enter your admin password followed by Return.
  6. Quit Terminal.

If you have any other Java Virtual Machines installed, these will remain inside the Java Virtual Machines folder, and you will still be able to use them. If you want to uninstall those, too, use the same process, but replace the name of the OpenJDK folder with the name of the one you want to uninstall.

OpenJDK is an open-source Java Development Kit that is used to create Java applications. If you have installed it on your Mac but no longer use it, you should uninstall it to free up space, prevent possible conflicts with other files, and avoid the risk of a possible malware exploit. Follow the steps above to uninstall OpenJDK on your Mac.