Add JAVA_HOME inference to script/compile, which is now required because of SPARK-1703