Getting away from hardcoding the configure-time JVM location and also getting
away from linking it would be ideal if you can swing it. As would getting away
from using the legacy Java 1.6 Framework. It’s got a stable location (apart
from having moved between the 2014 and 2015 versions), but Apple is poised to
get rid of it altogether.
Personally, dealing with Java on OS X really annoys me, but I’ll go ahead and
defend it just a bit. :-)
The JDK and associated JVM install on OS X has been vaguely standardized now as
of some point in the Java-1.7 series:
Fionna-3:~ hansen$ /usr/libexec/java_home
/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home
Apple hasn't decided to clobber that executable yet, so there is still a
reliable way to get at the java Home even if JAVA_HOME isn’t set.
Oracle finally settled on
/Library/Java/JavaVirtualMachines/jdk<major>_<minor>.jdk after a few earlier
hiccups. There are no guarantees with regard to pre-release 1.9 Javas, of course.
For whatever inscrutable reason, Oracle’s “just JVM” install for OS X is in a
completely different location:
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
That’s for 10.11. I don’t have other versions handy right now to check where
they install, and there may be some variation. I also always have a JDK
installed, so I can’t verify that the runtime Java tools know to point to that
JVM.