Not all setups will result in JNI_INCLUDE_DIRS having a value, in particular Android builds from standalone toolchain directories have the JNI headers installed in the standard include directories.
Instead of failing if the configure macro didn’t find a directory based on the installed Java runtime, only fail if we cannot build a JNI-including program.