Gradlew installation doesn't work

Hi,

I installed gradle manually ( https://gradle.org/install/).
Now I want to install gradlew ( https://docs.gradle.org/4.10.2/userguide/gradle_wrapper.html).

But then I get this error in the commandline:

**BUILD FAILED** in 0s

barry:~ macbookprobartvr$ sudo gradle wrapper

**> Task :wrapper** FAILED

FAILURE: Build failed with an exception.

* What went wrong:

Some problems were found with the configuration of task ':wrapper'.

> Cannot write to file '/opt/gradle/gradle-5.0-rc-3/bin/gradle/wrapper/gradle-wrapper.jar' specified for property 'jarFile', as ancestor '/opt/gradle/gradle-5.0-rc-3/bin/gradle' is not a directory.

> Cannot write to file '/opt/gradle/gradle-5.0-rc-3/bin/gradle/wrapper/gradle-wrapper.properties' specified for property 'propertiesFile', as ancestor '/opt/gradle/gradle-5.0-rc-3/bin/gradle' is not a directory.

Is the documentation wrong?

You should run this command in your application’s workspace root. It looks like you are running this from /opt/gradle/gradle-5.0-rc-3/bin/gradle