2017-04-15 96 views
2

我是新来的摇篮,并试图在我的Windows操作系统的PC安装摇篮,我下面提到的错误错误:无法找到或加载主类org.gradle.launcher.GradleMain

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

只有我做的事情是,我跟着网站的gradle给出Gradle installation的gradle的安装步骤,并在命令提示符下键入

gradle -v 

和我上面提到的例外。关于发生了什么以及如何解决它的任何线索。

这是我做了什么:

  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

回答

3

基本上这意味着摇篮找不到你gradle/wrapper/gradle-wrapper.jar

你必须遵循步骤3和设置环境变量:

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.

来源:https://gradle.org/install#configure

最简单的方法,就是在你的项目中只使用gradlew.bat,它会自动下载Gradle为您!

+2

是的。大多数情况下遇到这个错误只是错过了'gradle/wrapper/gradle-wrapper.jar'文件。 –

+0

@Max Peng:在使用gradlew时得到相同的错误,是的。 –

相关问题