Autodetect JAVA_HOME on RPM-based systems

Since this script has `set -e` enabled at the top, could this cause the script to exit prematurely (with no error message) if `rpm` is not defined?