Minor shell script fix

On Mac, if the user has set a JAVA_HOME, we should use that in preference to the system Java.