[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>

zero323/spark,mahak/spark,gengliangwang/spark,hvanhovell/spark,vinodkc/spark,ueshin/apache-spark,apache/spark,JoshRosen/spark,wangyum/spark,gengliangwang/spark,dongjoon-hyun/spark,xuanyuanking/spark,zzcclp/spark,xuanyuanking/spark,zzcclp/spark,witgo/spark,gengliangwang/spark,HyukjinKwon/spark,rednaxelafx/apache-spark,JoshRosen/spark,zero323/spark,shaneknapp/spark,gengliangwang/spark,cloud-fan/spark,rednaxelafx/apache-spark,JoshRosen/spark,cloud-fan/spark,WeichenXu123/spark,wangyum/spark,cloud-fan/spark,dongjoon-hyun/spark,shaneknapp/spark,ueshin/apache-spark,mahak/spark,shaneknapp/spark,mahak/spark,rednaxelafx/apache-spark,rednaxelafx/apache-spark,wangyum/spark,cloud-fan/spark,zero323/spark,xuanyuanking/spark,zzcclp/spark,nchammas/spark,nchammas/spark,holdenk/spark,apache/spark,wangyum/spark,HyukjinKwon/spark,ueshin/apache-spark,holdenk/spark,srowen/spark,shaneknapp/spark,hvanhovell/spark,hvanhovell/spark,witgo/spark,srowen/spark,apache/spark,wangyum/spark,srowen/spark,hvanhovell/spark,JoshRosen/spark,vinodkc/spark,nchammas/spark,ueshin/apache-spark,hvanhovell/spark,dongjoon-hyun/spark,shaneknapp/spark,holdenk/spark,WeichenXu123/spark,gengliangwang/spark,zero323/spark,gengliangwang/spark,apache/spark,zero323/spark,dongjoon-hyun/spark,zzcclp/spark,HyukjinKwon/spark,WeichenXu123/spark,holdenk/spark,xuanyuanking/spark,witgo/spark,zero323/spark,srowen/spark,dongjoon-hyun/spark,apache/spark,witgo/spark,vinodkc/spark,holdenk/spark,dongjoon-hyun/spark,srowen/spark,holdenk/spark,HyukjinKwon/spark,JoshRosen/spark,vinodkc/spark,wangyum/spark,WeichenXu123/spark,holdenk/spark,vinodkc/spark,ueshin/apache-spark,zzcclp/spark,srowen/spark,ueshin/apache-spark,JoshRosen/spark,mahak/spark,nchammas/spark,srowen/spark,WeichenXu123/spark,zzcclp/spark,nchammas/spark,witgo/spark,HyukjinKwon/spark,HyukjinKwon/spark,apache/spark,cloud-fan/spark,zzcclp/spark,mahak/spark,xuanyuanking/spark,gengliangwang/spark,JoshRosen/spark,vinodkc/spark,witgo/spark,WeichenXu123/spark,witgo/spark,xuanyuanking/spark,xuanyuanking/spark,hvanhovell/spark,vinodkc/spark,nchammas/spark,ueshin/apache-spark,rednaxelafx/apache-spark,zero323/spark,mahak/spark,wangyum/spark,nchammas/spark,WeichenXu123/spark,mahak/spark,shaneknapp/spark,cloud-fan/spark,shaneknapp/spark,dongjoon-hyun/spark,HyukjinKwon/spark,cloud-fan/spark,apache/spark,hvanhovell/spark,rednaxelafx/apache-spark,rednaxelafx/apache-spark