[SPARK-36856][BUILD] Get correct JAVA_HOME for macOS
[SPARK-36856][BUILD] Get correct JAVA_HOME for macOS

### What changes were proposed in this pull request?
Currently, JAVA_HOME may be set to path "/usr" improperly, now JAVA_HOME is fetched from command "/usr/libexec/java_home" for macOS.

### Why are the changes needed?
Command "./build/mvn xxx" will be stuck on MacOS 11.4, because JAVA_HOME is set to path "/usr" improperly.

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
`build/mvn -DskipTests package` passed on `macOS 11.5.2`.

Closes #34111 from copperybean/work.

Authored-by: copperybean <b3ed85939a2a47f77d4e925f4e353fb1188baa37@gmail.com>
Signed-off-by: Gengliang Wang <789196f1837e809005c9b5b207ae21d5a78ca970@apache.org>
(cherry picked from commit 56c21e8e5ac862846980e99fc9c803a7e656fae4)
Signed-off-by: Gengliang Wang <789196f1837e809005c9b5b207ae21d5a78ca970@apache.org>

milliman/spark,milliman/spark,milliman/spark,milliman/spark,milliman/spark,milliman/spark,milliman/spark