ylliX - Online Advertising Network

Quick tip: Update Java to 8 and set it as default version

Well, first part is quite easy, just go to http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html and grab jre-8-macosx-x64.dmg. After downloading doubleclick and install as normal app. After installation new browser window will be opened so you can run applet to check if new version is working. It should. Now the hard part, go to Terminal and type:

java -version

you will see something like:

java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

So does it work or not? Well, it is and it does not. Why? Becouse JRE just installed is only for browser. Apple allows only one JVM (Java Virtual Machine) at same time available for user, for Mavericks its Java 6. So what can we do to make it work also from commandline? Having Terminal opened type:

export JAVA_HOME="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home"

and now:

java -version

this time output will be:

java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)

So it seems everything works now. At least until Terminal restart. To make it permanent locate your .profile file (it is in /Users/xxx/.profile where xxx is your username), open it in any text editor and at bottom add:

export JAVA_HOME="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home"

Leave a Reply