错误:无法找到或加载主类org.gradle.launcher.GradleMain [英] Error: Could not find or load main class org.gradle.launcher.GradleMain

查看:842
本文介绍了错误:无法找到或加载主类org.gradle.launcher.GradleMain的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Gradle的新手,在尝试将Gradle安装到装有Windows操作系统的PC中时,出现了下面提到的错误:

 错误:无法找到或加载主类org.gradle.launcher.GradleMain 

确实是我遵循Gradle站点 Gradle安装中给出的gradle安装步骤并键入

  gradle -v 

in命令提示符,我得到了上述异常。

这就是我所做的:



  1. 下载zip文件

  2. 将zip文件中的'gradle-3.5'复制到我在C盘创建的文件夹中(C: \Gradle)

  3. 将GRADLE_HOME设置为'C:\Gradle\gradle-3.5'
  4. 将路径设置为'%GRADLE_HOME%\ bin'

  5. 打开cmd并输入gradle -v并得到这个错误



gradle / wrapper / gradle-wrapper.jar 。 第3步和设置环境变量:


Microsoft Windows用户


在文件资源管理器中,右键单击This PC(或Computer)图标,然后点击
点击属性 - >高级系统设置 - >环境
变量。



在系统变量下选择路径,然后点击编辑。为
添加一个条目C:\Gradle\gradle-3.5\bin。点击确定保存。


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



最简单的方法是简单地使用 gradlew。 bat 在你的项目中,它会自动为你下载 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

解决方案

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!

这篇关于错误:无法找到或加载主类org.gradle.launcher.GradleMain的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆