### What changes were proposed in this pull request?
This PR aims to find and set JAVA_HOME from the javac location.
### Why are the changes needed?
Since SPARK-35850, maven compile fails with Java8 when there is no JAVA_HOME and `java` path is JRE java.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Manually run mvn in vanilla ubuntu.
Closes#33075 from williamhyun/util.
Authored-by: William Hyun <william@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>