Set JAVA_HOME a bit more smartly.