在Intellij中gradle不起作用 - JAVA_HOME出现问题 [英] gradle doesn't work in Intellij - problems with JAVA_HOME

查看:1204
本文介绍了在Intellij中gradle不起作用 - JAVA_HOME出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  • 我可以从命令行运行gradle来查看它的版本。

  • 我可以在IntelliJ(10.0版本)中运行,编译和调试grails应用程序,版本10.2)

  • 我安装了IntelliJ Gradle插件。


    每当我尝试做任何事在Intellij中使用gradle我得到一个错误,如下所示:

     执行命令:tasks
    无法连接到gradle process for command'tasks'

    错误:JAVA_HOME设置为无效目录:C:\程序文件(x86)\JetBrains\IntelliJ IDEA 10.0\jre

    请在您的环境中设置JAVA_HOME变量以匹配Java安装的
    位置。

    但是在我的环境中,我有 JAVA_HOME set到不同目录中的正确JDK。另外,当我在IntelliJ中查看项目时,它还显示JDK位于正确的JDK位置。我找不到任何试图将JDK指向Intellij JRE位置的内容。



    有任何想法吗?

    解决方案

    IntelliJ使用自己的jre。



    强制IntelliJ使用它,您需要设置环境变量 IDEA_JDK 指向您的JDK。

    然后只需重新启动intellij和gradle gui插件即可使用。


    • I can run gradle from a command line to see its version.
    • I can run, compile and debug a grails app in IntelliJ (version 10.0 or version 10.2)
    • I installed the IntelliJ Gradle Plugin.

    Whenever I try to do anything with gradle from within Intellij I get an error as follows:

    Executing command: "tasks"
    Failed to connect to gradle process for command 'tasks'
    
    ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files (x86)\JetBrains\IntelliJ IDEA 10.0\jre
    
    Please set the JAVA_HOME variable in your environment to match the
    location of your Java installation.
    

    But in my environment I have JAVA_HOME set to the proper JDK in a different directory. Plus when I look in IntelliJ for the project, it also shows the JDK in the proper JDK location. I cannot find anything that attempts to point the JDK to the Intellij JRE location.

    Any ideas please?

    解决方案

    IntelliJ uses its own jre.

    to force IntelliJ to use it, you need to set the environment variable IDEA_JDK to point to your JDK.

    then simply restart intellij and gradle gui plugin should now work.

    这篇关于在Intellij中gradle不起作用 - JAVA_HOME出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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