Macos – how to install java 1.7 runtime on macos 10.9 mavericks

javamacos

I tried to install Java 7 Update 51.pkg, downloaded from here (http://java.com/en/download/mac_download.jsp?locale-=en), following the instructions here (http://java.com/en/download/help/mac_install.xml).

After the installation, in terminal, issuing java -version reports:

TimsMacBookAir:compiler-latest tim$ java -version
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)

I tried using java_home to report the installed versions:

TimsMacBookAir:~ tim$ /usr/libexec/java_home -v 1.7 --exec javac -version
Unable to find any JVMs matching version "1.7".
javac 1.6.0_65
TimsMacBookAir:~ tim$ /usr/libexec/java_home -v 1 --exec javac -version
javac 1.6.0_65

I tried running the java package multiple times, rebooting, etc.

Even after installing with apparent success, /System/Library/Frameworks/JavaVM.framework/Versions/ does NOT list java 1.7 being installed, and as such I can't use https://stackoverflow.com/questions/12757558/installed-java-7-on-mac-os-x-but-terminal-is-still-using-version-6.

I am trying to run java at the command line. I don't need to use java in browsers, nor care if it works in browsers or not. I also cannot find the "java preferences" control panel / applet anywhere.

Best Answer

Yeah - this is a huge f**g hairball, thanks mostly to Apple for their blockheaded resistance to supporting their users. There are some links that seem to allow one to manage their situation. I currently use Mavericks 10.9.4. Here's my take on the way to proceed:

DISCLAIMER: I am not expert on OSX, nor with Java, so follow these instructions with care. All I can say is that they semmed to work for me.

First, know that installing the latest version of Java (the JRE) gets the latest software on your system, but your system doesn't necessarily use it! To do that, you'll need to make use of the command line. Here's what I did:

First, I installed the latest version of Java, as downloaded from Oracle's Java website. To see if the new version was 'registered' in OSX, use the following command. This result shows that the 'system' doesn't recognize the upgrade, and won't be using it.

MacBook-1:~ jmoore$ java -version
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)

After some research, the solution seems to be the following:

MacBook-1:~ jmoore$ export JAVA_HOME="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home" 

Now, let's check the version again to see if we've made any progress:

MacBook-1:~ jmoore$ java -version
java version "1.7.0_60"
Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode) 

OK! I think that's it.

Related Question