Mavericks java recipe?
Lawrence Velázquez
larryv at macports.org
Fri Nov 15 17:56:33 PST 2013
On Nov 15, 2013, at 3:04 PM, "Daniel J. Luke" <dluke at geeklair.net> wrote:
> Before I do more work on #41378, I figured that I'd ask and see if anyone has worked up a nice recipe for detecting a java install on Mavericks yet?
>
> I'd like the subversion-javahlbindings port to be able to warn people and exit early if the appropriate java bits aren't present and I imagine other ports might want the same thing (possibly a candidate for a portgroup, too).
I don't have a Mavericks system yet, but /usr/libexec/java_home always exists on Mountain Lion, even if no JVM is installed. If a JVM is available, "/usr/libexec/java_home --failfast" returns 0 and prints the appropriate $JAVA_HOME; otherwise, it returns 1 and prints nothing.
% /usr/libexec/java_home -F
/Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home
% echo $?
0
Testing for a whole JDK might be subtly different than just testing for a JVM; I'm not sure. Perhaps you could grep for "jdk" in the output.
vq
More information about the macports-dev
mailing list