Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Could not find or load main class org.gradle.launcher.GradleMain

Tags:

gradle

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 :

  1. Downloaded the zip file
  2. Copied 'gradle-3.5' from the zip file to a folder I created in C drive (C:\Gradle)
  3. Set GRADLE_HOME to 'C:\Gradle\gradle-3.5'
  4. Set Path to '%GRADLE_HOME%\bin'
  5. Opened cmd and typed gradle -v and got this error
like image 315
Ron Thomas Avatar asked Apr 15 '17 13:04

Ron Thomas


2 Answers

I stopped all the gradle daemons by running ./gradlew --stop and the error was resolved for me.

like image 96
Sumit Avatar answered Oct 14 '22 06:10

Sumit


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!

like image 41
Jared Burrows Avatar answered Oct 14 '22 05:10

Jared Burrows