Could not initialize class BeanDynamicObject in MacOS

Please help, I have installed JDK 1.8.0_161 and Gradle 4.6 on my MacOS 10.10, and set the JAVA_HOME, GRADLE_USER_HOME, & GRADE_HOME correctly in .bash_profile based on the instruction on https://docs.gradle.org/4.6/userguide/installation.html,

but when I run the gradle command many and many times, it still had the following exception messages, any experts can help???

MacBook-Air:~ simon$ gradle

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not initialize class org.gradle.internal.metaobject.BeanDynamicObject

BUILD FAILED in 1s