Hail 0.2 building from source fails on AWS EMR: No rule to make target `jni.h'

The build command for Hail 0.2 against Spark 2.4.4 (Amazon Linux 2.8.5) fails with the error:

s/jre/include/linux ApproximateQuantiles_test.cpp -MG -M -MF build/ApproximateQuantiles_test.d -MT build/ApproximateQuantiles_test.o

make[1]: Leaving directory /home/hadoop/hail/hail/src/main/c' make[1]: Entering directory /home/hadoop/hail/hail/src/main/c’
make[1]: *** No rule to make target jni.h', needed by build/NativeBoot.o’. Stop.
make[1]: Leaving directory `/home/hadoop/hail/hail/src/main/c’
make: *** [native-lib-prebuilt] Error 2

Steps to reproduce:

git clone https://github.com/broadinstitute/hail.git
cd hail/hail
make install HAIL_COMPILE_NATIVES=1 SPARK_VERSION=2.4.4

or

make install-on-cluster HAIL_COMPILE_NATIVES=1 SPARK_VERSION=2.4.4

You need to install the Java Development Kit (JDK) then make clean and try again

Yeah, it was a problem of JAVA_HOME not pointing to the right place. Explicitly setting it while building Hail solved the issue.