Gracefully handle unset JAVA_HOME
Gracefully handle unset JAVA_HOME

getenv("JAVA_HOME") may return a null pointer; in this case, the
corresponding string is in a state where calling .empty() segfaults.
However, there is a legimitate use case for JAVA_HOME not being set;
in fact, the default "/usr/local/openjdk8" is usually fine on FreeBSD.

--
Change-Id: I4a2ad7d19ef38c79e9f1c62b0f8041e434203c7f
Reviewed-on: https://cr.bazel.build/7590
MOS_MIGRATED_REVID=140716748

safarmer/bazel,kchodorow/bazel,twitter-forks/bazel,spxtr/bazel,juhalindfors/bazel-patches,damienmg/bazel,safarmer/bazel,katre/bazel,dropbox/bazel,aehlig/bazel,aehlig/bazel,dslomov/bazel,ulfjack/bazel,Asana/bazel,perezd/bazel,spxtr/bazel,mikelikespie/bazel,aehlig/bazel,dslomov/bazel-windows,perezd/bazel,cushon/bazel,werkt/bazel,juhalindfors/bazel-patches,meteorcloudy/bazel,LuminateWireless/bazel,hermione521/bazel,damienmg/bazel,aehlig/bazel,dslomov/bazel,snnn/bazel,bazelbuild/bazel,juhalindfors/bazel-patches,dropbox/bazel,akira-baruah/bazel,dslomov/bazel-windows,spxtr/bazel,ButterflyNetwork/bazel,juhalindfors/bazel-patches,twitter-forks/bazel,mikelikespie/bazel,variac/bazel,bazelbuild/bazel,variac/bazel,davidzchen/bazel,kchodorow/bazel-1,variac/bazel,variac/bazel,twitter-forks/bazel,juhalindfors/bazel-patches,kchodorow/bazel,aehlig/bazel,katre/bazel,spxtr/bazel,hermione521/bazel,safarmer/bazel,davidzchen/bazel,LuminateWireless/bazel,cushon/bazel,kchodorow/bazel-1,dslomov/bazel,werkt/bazel,spxtr/bazel,ButterflyNetwork/bazel,akira-baruah/bazel,akira-baruah/bazel,safarmer/bazel,variac/bazel,davidzchen/bazel,ButterflyNetwork/bazel,ButterflyNetwork/bazel,ulfjack/bazel,variac/bazel,snnn/bazel,katre/bazel,meteorcloudy/bazel,ulfjack/bazel,Asana/bazel,juhalindfors/bazel-patches,cushon/bazel,Asana/bazel,Asana/bazel,mikelikespie/bazel,LuminateWireless/bazel,twitter-forks/bazel,werkt/bazel,perezd/bazel,spxtr/bazel,juhalindfors/bazel-patches,bazelbuild/bazel,dslomov/bazel,werkt/bazel,akira-baruah/bazel,bazelbuild/bazel,davidzchen/bazel,perezd/bazel,Asana/bazel,meteorcloudy/bazel,katre/bazel,katre/bazel,hermione521/bazel,perezd/bazel,twitter-forks/bazel,werkt/bazel,kchodorow/bazel,davidzchen/bazel,bazelbuild/bazel,dslomov/bazel,perezd/bazel,akira-baruah/bazel,dslomov/bazel-windows,hermione521/bazel,spxtr/bazel,Asana/bazel,LuminateWireless/bazel,aehlig/bazel,aehlig/bazel,LuminateWireless/bazel,ulfjack/bazel,twitter-forks/bazel,meteorcloudy/bazel,damienmg/bazel,damienmg/bazel,ulfjack/bazel,snnn/bazel,kchodorow/bazel,meteorcloudy/bazel,cushon/bazel,kchodorow/bazel-1,kchodorow/bazel,perezd/bazel,snnn/bazel,ulfjack/bazel,snnn/bazel,hermione521/bazel,twitter-forks/bazel,Asana/bazel,kchodorow/bazel,cushon/bazel,mikelikespie/bazel,damienmg/bazel,dslomov/bazel-windows,dropbox/bazel,kchodorow/bazel-1,safarmer/bazel,dropbox/bazel,dslomov/bazel-windows,ulfjack/bazel,kchodorow/bazel-1,damienmg/bazel,snnn/bazel,hermione521/bazel,ButterflyNetwork/bazel,dslomov/bazel,dslomov/bazel-windows,cushon/bazel,safarmer/bazel,davidzchen/bazel,kchodorow/bazel-1,mikelikespie/bazel,akira-baruah/bazel,davidzchen/bazel,dropbox/bazel,dslomov/bazel,kchodorow/bazel,katre/bazel,bazelbuild/bazel,meteorcloudy/bazel,LuminateWireless/bazel,werkt/bazel,variac/bazel,meteorcloudy/bazel,ButterflyNetwork/bazel,mikelikespie/bazel,dropbox/bazel,damienmg/bazel,snnn/bazel