Nifty way of Switching JDK versions on OSX

This SuperUser post details a nice way to easily and quickly switch JDK versions on OSX. Just add the function to your ~/.bash_profile, and switching from Java 7 to Java 8 is a simple as this:

derrick:~ derrick$ setjdk 1.8
JAVA_HOME set to /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)
derrick:~ derrick$

Credit to Neeme Praks.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s