Be smarter about setting $JAVA_HOME