One way I've used to set JAVA_HOME in the past is to use the /usr/libexec/java_home command to print the value of JAVA_HOME for the current java executable. Set the output into JAVA_HOME with something like this in the terminal where you run the installer.
export JAVA_HOME=$(/usr/libexec/java_home)
echo $JAVA_HOME