How to Completely Uninstall JDK on macOS
- Details
- Written by Nam Ha Minh
- Last Updated on 29 April 2022   |   Print Email
1. Uninstall Oracle JDK on macOS
If you have a JDK installation that was installed by Oracle JDK installer, you need to find the JDK directory in the/Library/Java/JavaVirtualMachines path. Open a terminal window, change the current directory:cd /Library/Java/JavaVirtualMachines
Then type ls command to see the installed JDK directories. You may find more than one JDK. Then type the following command to remove a JDK installation completely from macOS:sudo rm -rf jdk-version
This command will be executed under root privilege (password required) - the specified JDK directory will be deleted recursively and forcefully.If you uninstall JDK 1.8, you also need to remove 2 other directories using the following commands:sudo rm -rf /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -rf /Library/PreferencePanes/JavaControlPanel.prefpane
Then you’re all done.
2. Uninstall OpenJDK on macOS
If you have OpenJDK installation, it’s very likely that it was extracted from an archive file to a specific directory. Open a terminal window, and type which java to see all locations pointing to the java program - it gives you some clues about where the JDK installation directory is.The simply type the following command to completely uninstall OpenJDK from macOS:Related Articles:
- How to set JAVA_HOME in macOS and Linux permanently
- How to set JAVA_HOME environment variable on Windows 10
- What are JVM, JRE and JDK
- How to write, compile and run a hello world Java program for beginners
- Java Core Language Tutorials
About the Author:
Nam Ha Minh is certified Java programmer (SCJP and SCWCD). He began programming with Java back in the days of Java 1.4 and has been passionate about it ever since. You can connect with him on Facebook and watch his Java videos on YouTube.
Comments
Couldn't get rid of OpenJdk. Now I did, thanks