GradleWrapperMain man error MacOS

I keep getting Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain when trying to run ./gradlew. After looking at other forums I have the gradle-wrapper.jar in the right directory and gradle-wrapper.properties too. Any ideas to why this could be happening?

My directory is of following:

  • build.gradle
  • gradle:
    • wrapper:
  •      gradle-wrapper.jar
    
  •      gradle-wrapper.properites
    
  • gradlew
  • gradlew.bat
  • src: (main/java/etc)