Java is one of the most confusing and frustrating add-ons for Mac and here we show you the easiest way to uninstall Java from El Capitan, Sierra and High Sierra. The truth is, there’s actually no way to fully remove Java from Mac but you can easily completely disable it. The instructions provided here show how to disable Java from El Capitan OS X 10.11, macOS 10.12 Sierra and macOS 10.13 High Sierra but it works for all versions of OS X including OS X 10.6 Snow Leopard, OS X 10.7 Lion, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks and OS X 10.10 Yosemite. If you’ve got here because you keep getting a Java SDK error message in El Capitan or macos Sierra, there is probably an application installed on your Mac that requires Java or a website or game (such as Minecraft) that you’re trying to access that requires it. You can find instructions here how to install Java on El Capitan & Sierra or you can simply uninstall the application that keeps prompting you to use Java if you don’t need it anymore. Once you’ve identified the application or websites that keep demanding Java, you can use the following instructions to rid your Mac of Java for good.
- You can uninstall older versions of Java manually in the same way as you would uninstall any other software from your Windows computer. Older versions of Java may appear in the program list as J2SE, Java 2, Java SE or Java Runtime Environment. Windows 10 - Uninstall Programs.
- Many Mac users don’t need Java on their computer, but if you happen to have Java installed and want to remove it from a Mac then you can uninstall Java and JRE with a little effort. Uninstalling Java and JRE from the Mac is a little more complicated than installing it, as there is no dedicated.
How To Uninstall Java From El Capitan, Sierra & High Sierra
The annoying fact is that there is no way to 100% remove Java from your Mac. Once you’ve installed it, it installs deep inside OS X and it’s there for good so the best advice is don’t install Java on your Mac unless you 100% need it! However, the good news is that you can completely disable it in just one move so that it can’t cause any further problems on your Mac. Note that the official Java uninstall instructions for Mac from Oracle only disable Java – they do not actually remove Java from your Mac. They are also a bit complicated to follow if you’re new to Macs as it requires using Terminal commands in OS X.
First we start with a quick and easy way to disable Java in El Capitan, Sierra & High Sierra. Then we show you how to use Terminal to remove as much of Java as possible from your Mac.
Follow these instructions to uninstall Java from El Capitan & Sierra.
Unfortunately when you install a new version of Java the old one is not deleted. Sun does this just in case some old applications won't work with the latest Java version. In my experience, this is a rarity. JavaRa is a free utility that will permanently remove all old and vulnerable versions of Java from your PC. Apr 07, 2015 How do I install older version of JDK on Mac? On Apple's website, I can only find the latest JDK. Is there a way to get older versions of JDKs for Mac? Java macos mechanicalturk jdk1.5. Share improve this question. Edited Apr 7 '15 at 19:22. 35.5k 9 75 112. How to install Java 8 on Mac. Installing ADB on macOS.
- Go to the root Library folder in Library/Internet Plug-Ins and delete everything related to Java. To access your root Library folder, open Finder and click on the “Go” menu at the top. Hold down the “Alt” key (also known as the “Option” key) and you will see the Library folder appear:
- Once you’re in the Library folder, delete absolutely everything related to Java. If you also had the JDK (Java Development Kit) installed, you also need to navigate to /Library/Java/JavaVirtualMachines/ and delete anything that you see. Then go back to your Mac desktop and click on your Macintosh HD and go to your /System/Library folder and delete everything related to Java there too.
This instantly disables Java on your Mac and prevents it from infecting your Mac in any way via Java applets in websites or apps. Note that you should quit and restart any browsers you had open and you can surf safe in the knowledge that Java can’t do any harm to your Mac.
How To Uninstall Java Using Terminal
Java
If you’re confident using Terminal on your Mac or the above method doesn’t work for some reason, you can remove more traces of Java with a few simple commands. However, first you need to disable a new layer of protection to OS X 10.11 that Apple has added called “Rootless SIP”.
Here’s how to uninstall Java from El Capitan & Sierra using Terminal in OS X.
- Firstly you need to disable Rootless SIP in OS X. Restart your Mac when the screen turns black hold down ⌘R until the Apple logo appears.
- Select the “Utilities” menu and then “Terminal”. In Terminal type: csrutil disable
- Hit Return and then restart OS X. Your Mac will then restart with SIP disabled and you can try installing Java again.
- You can then use Terminal to remove Java by typing the following in Terminal:
sudo rm -fr /Library/Internet Plug-Ins/JavaAppletPlugin.plugin and press Enter
sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefpane and press Enter
sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefpane and press Enter
You can also remove the Java JDK by typing:
sudo rm -fr/System/Library/Java/JavaVirtualMachines/1 .6.0.jdk and press Enter
If this doesn’t work, you can try:
cd /Library/Java/JavaVirtualMachines and press Enter
ls and press Enter
sudo rm -rf jdk1.8.0_25.jdk and press Enter
ls and press Enter
sudo rm -rf jdk1.8.0_25.jdk and press Enter
Note: The 1.8.0_25.jdk part should be replaced by whatever Java version you have installed if you have a different version to 1.8. To check which version of Java you have installed simply type: java -version in Terminal:
When you’ve done all this, it’s a good idea to re-enable Rootless SIP protection on El Capitan & Sierra. All you have to do is follow the same instructions as for disabling it except instead of csrutil disable you type: csrutil enable
Even after this, there will be traces of Java files on your Mac in other locations (such as /usr/bin) but you really don’t need to worry about them as removing them can mess up OS X. You can double check whether Java still exists in your system by typing java -version in Terminal and it will show you exactly which version of Java you have installed. Note that Java version numbers are a bit confusing because what are installed on your system as Java 1.6, 1.7 and 1.8 are known more commonly as Java 6, Java 7 and Java 8 respectively.
Note that if you’re trying to install Java 6 on Mac (called Java 1.6 by Oracle) and you keep getting the error message:
A newer version of Java is already installed
Make sure that you are downloading the correct version of Java 6 from the Apple website which currently is Java for OS X 2015-001.
If you have any questions or problems disabling Java on your Mac this way, let us know in the comments below. If you found this tutorial helpful, you may also find our guide on how to uninstall Office 2016 for Mac useful too.
Active10 months ago
How can I install an additional java on MacOS? I installed jdk8 and that works fine. but now I need a jdk7 installation for development purposes. When trying to install the old version via DMG file, i get a warning, that there is already a newer version of java installed and the installer quits.
How to install jdk7 in addition to this one?
Thanks
Dakky
Dakky
user8389458
DakkarDakkar1,72544 gold badges1515 silver badges2626 bronze badges
9 Answers
The cleanest way to manage multiple java versions on Mac is to use
Homebrew
.And within
Homebrew
, use:homebrew-cask
to install the versions of javajenv
to manage the installed versions of java
As seen on http://hanxue-it.blogspot.ch/2014/05/installing-java-8-managing-multiple.html , these are the steps to follow.
- install homebrew
- install homebrew jenv
- install homebrew-cask
- install a specific java version using cask (see 'homebrew-cask versions' paragraph below)
- add this version for jenv to manage it
- check the version is correctly managed by jenv
- repeat steps 4 to 6 for each version of java you need
homebrew-cask versions
Add the
homebrew/cask-versions
tap to homebrew using:Then you can look at all the versions available:
Then you can install the version(s) you like:
And add them to be managed by jenv as usual.
I think this is the cleanest & simplest way to go about it.
Another important thing to note, as mentioned in Mac OS X 10.6.7 Java Path Current JDK confusing :
For different types of JDKs or installations, you will have different paths
You can check the paths of the versions installed using
/usr/libexec/java_home -V
, see How do I check if the Java JDK is installed on Mac?On Mac OS X Mavericks, I found as following:
1) Built-in JRE default:
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
2) JDKs downloaded from Apple:
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/
3) JDKs downloaded from Oracle:
/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home
Resources
- 'brew tap” explained https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/brew-tap.md
- “brew versions” explained Homebrew install specific version of formula? and also https://github.com/Homebrew/homebrew-versions
- “cask versions”, similar to “brew versions”, see https://github.com/caskroom/homebrew-versions and also https://github.com/caskroom/homebrew-cask/issues/9447
1,54411 gold badge2525 silver badges4343 bronze badges
Adrien BeAdrien Be14k1212 gold badges7474 silver badges125125 bronze badges
Uninstall jdk8, install jdk7, then reinstall jdk8.
My approach to switching between them (in .profile) :
Then you can simply type
java7
or java8
in a terminal to switch versions.(edit: updated to add Dylans improvement for Java 9)
VegardVegard3,23211 gold badge1212 silver badges2525 bronze badges
For macOS Sierra 420
This guide was cobbled together from various sources (replies above as well as other posts), and works perfect.
0. If you haven't already, install homebrew.
See https://brew.sh/
1. Install jenv
2. Add jenv to the bash profile
3. Add jenv to your path
4. Tap 'caskroom/versions'
FYI: 'Tap' extends brew's list of available repos it can install, above and beyond brew's default list of available repos.
5. Install the latest version of java
6. Install java 6 (or 7 or 8 whatever you need)
? Maybe close and restart Terminal so it sees any new ENV vars that got setup.
7. Review Installations
All Java version get installed here:
/Library/Java/JavaVirtualMachines
lets take a look.8. Add each path to jenv one-at-a-time.
We need to add '/Contents/Home' to the version folder.WARNING: Use the actual paths on your machine.. these are just EXAMPLE's
9. Check if jenv registered OK
10. Set java version to use (globably)
Where XX matches one of the items in the versions list above.
Check java version
Check jenv versions
Should also indicate the current version being used with an asterisk.
DONE
Quick future reference
To change java versions
.. See the list of available java versions
.. then, where XX matches an item in the list above
bobbob4,55911 gold badge2929 silver badges2929 bronze badges
SDKMAN! is a great tool for using multiple versions of Java, Gradle, Groovy, Kotlin, and other JVM tools on Mac OS. Installation and usage doc are plainly on the main site.
(I have no affiliation, just a happy user).
As an example usage, if I type the following in a Terminal window, there is a list of available Java SDK versions (edited for brevity):
Here
+
denotes that the version is installed. >
denotes which version is currently in use. To install a version:To use a version in this Terminal window:
Michael EasterMichael Easter17.8k77 gold badges6060 silver badges8888 bronze badges
As found on this websiteSo Let’s begin by installing jEnv
- Run this in the terminal
- Add jEnv to the bash profile
- When you first install jEnv will not have any JDK associated with it.For example, I just installed JDK 8 but jEnv does not know about it. To check Java versions on jEnvAt the moment it only found Java version(jre) on the system. The
*
shows the version currently selected. Unlike rvm and rbenv, jEnv cannot install JDK for you. You need to install JDK manually from Oracle website. - Install JDK 6 from Apple website. This will install Java in
/System/Library/Java/JavaVirtualMachines/
. The reason we are installing Java 6 from Apple website is that SUN did not come up with JDK 6 for MAC, so Apple created/modified its own deployment version. - Similarly install JDK7 and JDK8.
- Add JDKs to jEnv.JDK 6:JDK 7:JDK 8:
- Check the java versions installed using jenv
- So now we have 3 versions of Java on our system. To set a default version use the commandEx – I wanted Jdk 1.6 to start IntelliJ Internet download manager for mac.
- check the java versionjava -version
That’s it. We now have multiple versions of java and we can switch between them easily. jEnv also has some other features, such as wrappers for Gradle, Ant, Maven, etc, and the ability to set JVM options globally or locally. Check out the documentation for more information.
Dinesh AroraDinesh Arora1,16111 gold badge1515 silver badges2323 bronze badges
I find this Java version manager called Jabba recently and the usage is very similar to version managers of other languages like rvm(ruby), nvm(node), pyenv(python), etc. Also it's cross platform so definitely it can be used on Mac.
After installation, it will create a dir in ~/.jabba to put all the Java versions you install. It 'Supports installation of Oracle JDK (default) / Server JRE, Zulu OpenJDK (since 0.3.0), IBM SDK, Java Technology Edition (since 0.6.0) and from custom URLs.'.
Basic usage is listed on their Github. A quick summary to start:
York YangYork Yang
I am using Mac OS X 10.9.5. This is how I manage multiple JDK/JRE on my machine when I need one version to run application A and use another version for application B.
I created the following script after getting some help online.
I put the above script in .profile file. Just open terminal, type vi .profile, append the script with the above snippet and save it. Once your out type
source .profile
, this will run your profile script without you having to restart the terminal. Now type java -version
it should show 1.7 as your current version. If you intend to change it to 1.8 then comment the line setjdk jdk1.7.0_15.jdk
and uncomment the line setjdk jdk1.8.0_60.jdk
. Save the script and run it again with source command. I use this mechanism to manage multiple versions of JDK/JRE when I have to compile 2 different Maven projects which need different java versions.ChaitanyaBhattChaitanyaBhatt
Hp instant printing software. Jenv on Mac Sierra:
if not working after install, do this bug fix to add java executable to path
even though
eval '$(jenv init -)'
could do this job. The reason is /bin folder is not there anymore as describe in it's homepage, but shim folder is used as /bin instead.- Make sure ~/.jenv is there
which java
may print /Library/..- jenv global 1.8
- jenv shell 1.8
Eventually,
which java
gives you:/Users/xxxx/.jenv/shims/java
CodeFarmerCodeFarmer
Here's a more DRY version for bash (Based on Vegard's answer)
Replace 1.7 and 1.8 with whatever versions you are interested withand you'll get an alias called 'javaX'; where 'X' is the java version (7 / 8 in the snippet below) that will allow you to easily switch versions
elad.chenelad.chen1,61644 gold badges2020 silver badges2929 bronze badges