improved detection of JAVA_HOME on mac