Saturday, July 2, 2016

Changing Your JDK on OS X

So you installed the newest and greatest JDK, maybe an early release. You have buyer's remorse, and want to go back to an older version of the JDK.

Good luck with that.

I'm joking!

First you need to know what versions of the JDK are currently on your OS X box. Check in the following directory.

/Library/Java/JavaVirtualMachines

That should have a list of your installed JDK's.

Alternatively, you can see your installed JDK's using the following command.

/usr/libexec/java_home -V

This list may include additional JDK's if you have a computer that's been around the block a few times.

Now, the real trick is running the one you want. If you just want to run a specific command using a specific JDK, then you might consider using the java_home tool.