I'm new to Gradle and while trying to install Gradle in my PC with Windows OS, I got the below mentioned error
Error: Could not find or load main class org.gradle.launcher.GradleMain
Only thing I did is that I followed the gradle installation steps given in gradle site Gradle installation and typed
gradle -v
in command prompt and I got the above mentioned exception. Any clue as to what had happened and how to resolve it.
This is what I have done :
- Downloaded the zip file
- Copied 'gradle-3.5' from the zip file to a folder I created in C drive (C:\Gradle)
- Set GRADLE_HOME to 'C:\Gradle\gradle-3.5'
- Set Path to '%GRADLE_HOME%\bin'
- Opened cmd and typed gradle -v and got this error
I stopped all the gradle daemons by running ./gradlew --stop and the error was resolved for me.
Basically this means that Gradle can't find your gradle/wrapper/gradle-wrapper.jar
.
You have to follow Step 3 and setup environment variables:
Microsoft Windows users
In File Explorer right-click on the This PC (or Computer) icon, then click Properties -> Advanced System Settings -> Environmental Variables.
Under System Variables select Path, then click Edit. Add an entry for C:\Gradle\gradle-3.5\bin. Click OK to save.
Source: https://gradle.org/install#configure
The easiest way, is to simply use gradlew.bat
in your project and it will auto download Gradle
for you!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With