gradle project import resolve error

Hello,

I'm trying to import Libgdx gradle project to newest IntelliJ on mac osx, I have Resolve Error window with: "Please, use JDK instead of JRE for Gradle importer". I don't understand this message. What is wrong?

Greetings

Peter

6 comments
Comment actions Permalink

What JVM version do you have specified for Gradle?

http://i.imgur.com/OezbLE3.png

What Gradle version do you use?

0
Comment actions Permalink

oh, it was because i don't have jdk path at project settings :) Thank You

0
Comment actions Permalink

I have a simiar problem, but I'm trying to import a project from a build.gradle file so I'm not sure where to put my project settings.  My gradle preferences do not allow me to specify the gradle JVM (see scrnshot1.png attached). The import project from gradle (snrnshot2.png attached) only has 2 entries to select from:
#JAVA_INTERNAL
Use JAVA_HOME (not defined yet)

I don't understand why IntelliJ IDEA can't read my java home.  It is set as follows:

Kurts-Mac-mini:~ kandrews$ echo $JAVA_HOME

/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home

Kurts-Mac-mini:~ kandrews$

I don't understand why I don't have a way to set the gradle JVM in the preferences (scrnshot1.png)

Either there are some additional configuration steps that I missed somehow, or ther is a possible bug in the IDE.

I should tell you that the version of gradle that I'm using is the one that comes with the grails install it is not installed as a seperate application.

This is the grails environment:

| Grails Version: 3.0.1

| Groovy Version: 2.4.3

| JVM Version: 1.8.0_45

The IntelliJ version and build info is in scrnshot3.png (attached).

Also the links on the error message dialog don't work. (scrnshot4.png attached)

Message was edited by: Kurt Andrews

Message was edited by: Kurt Andrews



Attachment(s):
scrnshot3.png
scrnshot1.png
snrnshot2.png
scrnshot4.png
0
Comment actions Permalink

My gradle preferences do not allow me to specify the gradle JVM (see scrnshot1.png attached).

You do not have any imported gradle project yet and the gradle JVM is project specific setting.

The import project from gradle (snrnshot2.png attached) only has 2 entries to select from:
#JAVA_INTERNAL
Use JAVA_HOME (not defined yet)

#JAVA_INTERNAL is obsolete value, see my answer at https://devnet.jetbrains.com/message/5543369#5543369

I don't understand why IntelliJ IDEA can't read my java home.  It is set as follows:

Kurts-Mac-mini:~ kandrews$ echo $JAVA_HOME

/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home

It seems, you run IDEA under different environment than the shell

I don't understand why I don't have a way to set the gradle JVM in the preferences (scrnshot1.png)

Either there are some additional configuration steps that I missed somehow, or ther is a possible bug in the IDE.

sdk_setup.pnggradle_settings.png

0
Comment actions Permalink

Problem resolved!  This answer along with https://devnet.jetbrains.com/message/5543571#5543571, provides everything needed to solve the problem, but I'd like to suggest an improvement to IDEA's response to the use case: no project has been created and the first project is imported from a gradle build file.

The #JAVA_INTERNAL issue has been reported as a bug in https://youtrack.jetbrains.com/issue/IDEA-138942.  The $JAVA_HOME (not defined yet) has to be handled outside of the application.  I've seen a few articles about using launchd daemons, but I haven't tried it yet.  However, I think that if a JDK is installed, IDEA has enough information to construct a possible default without forcing the user to create a project.  Looking at the about dialog, IDEA can figure out where to find the JRE, could it also find the JDK if it exists?  If there is some technical reason that's not feasable, maybe the global SDK configuration should be moved outside of the project scope and let the project settings override the global settings if desired.  I'm new to the community so I'm not sure how to request this kind of a change.

Thanks to Vladaslav and Serge for all of the help.

Regards,

Kurt

0
Comment actions Permalink

I ran into this issue on Windows.

 

My solution was to define JAVA_HOME in System->Advanced System Settings->Environment Variables->System Variables and point it to the location of my JDK install which in this instance was in C:\Program Files\Java\jdk1.8.0_111

 

I restarted IntelliJ and was able to open the project.

 

 

 

0

Please sign in to leave a comment.