Installing a Java 8 JDK on OS X using Homebrew

Reading time ~1 minute

I've had a 'manual' install of JDK 8 on my Mac for quite a while, mainly to run Clojure. It was the typical "download from the Oracle website, then manually run the installer" deployment. As I move the management of more development tools from manual management over to homebrew, I decided to use homebrew to manage my Java installation also. It's just so much easier to get updates and update information all in one place. Oh, and installs the same JDK anyway, just without all the additional pointy clicky work.

Removing the existing installation

Fortunately Oracle has uninstall instructions on their website. It's a rather manual approach but at least it is documented and the whole procedure consists of three commands. Unfortunately in my case this didn't end up uninstalling an older version of the JDK. For some reason, I had ended up with both 1.8.060 and 1.8.0131 installed on my machine, and Oracle's uninstall instructions didn't touch the 1.8.0_60 install in /System/Library/Frameworks/JavaVM.framework. I suspect this is an older JDK brought over from the Yosemite install and the consensus on the Internet I could find suggest to leave that alone as the system needs those.

Apparently in older versions of OS X it was possible to run /usr/libexec/java_home -uninstall to get rid of a Java install, but that option does not appear to work in OS X Sierra anymore.

Installing Java using Homebrew

The installation via homebrew is about as simple as expected. I have cask installed already, so for me it's a simple matter of running

my-machine:~ brew cask install java

and it will install the latest Oracle JDK. You can use

my-machine:~ brew cask info java

to verify which version it will install.

If you haven't got homebrew installed, follow the installation instructions and also make sure that you install cask:

my-machine:~ brew tap caskroom/cask

After re-installing the JDK using homebrew, java_home also finally reports the correct version:

my-machine:~ timo$ /usr/libexec/java_home
/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
my-machine:~ timo$

SE-Radio interviews Ron Lichty, must listen for development managers

The [Software Engineering Radio](http://www.se-radio.net/) podcast has just published an episode with an interview with Ron Lichty.If you...… Continue reading

Emacs 25.3 released

Published on September 14, 2017