JAVA_HOME Location on a Mac is no longer reliable

This comes directly from

# OSX always places Java in the same location so we can reliably set JAVA_HOME
if [ "$DIST_OS" = "macosx" ]
    if [ -z "$JAVA_HOME" ]; then
        JAVA_HOME="/Library/Java/Home"; export JAVA_HOME

As of at least OS X 10.9 (and I think a bit earlier), if you install the Oracle version of Java (which you must do if you want Java 7) the install location for Java is:

/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home

I’m not sure why [ -z "$JAVA_HOME" ]; evaluates true in this case as “echo $JAVA_HOME” yields the above path in my terminal (bash is far from my thing). In any case, modifying the shell script to use that path points Ignition at the 1.7 JRE.

This shell script is part of the JSW distribution… maybe we can check if they’ve got an updated vesion.

FWIW, the reliable way to get a value usable for JAVA_HOME on OS X (as of 10.9 or Java 7, anyway, not sure about earlier) is to execute /usr/libexec/java_home and use the result.

kevin-dev-mbp:~ kevin$ /usr/libexec/java_home 

I have this set in my ~/.profile


The wrapper’s shell script should probably do the same when JAVA_HOME isn’t set.

Looks like the main reason I am seeing this problem is that I downloaded the JRE for this machine which installs to the plug-in location, and which apparently no amount of export JAVA_HOME="… will remedy the /usr/libexec/java_home situation.

Lesson learned: always get the JDK even if you don’t plan to write a line of Java on that machine.