I think in general when building it's good to make them set JAVA_HOME explicitly. Otherwise it's really hard to reason about which java is getting detected.