escape spaces in JAVA_HOME

fix 3725

(cherry picked from commit a657a511e2231d13079070584b48b5dca0079e10)