invalid gradle jdk configuration found
Answered
The gradle JDK configuration is not settable if you are running IntelliJ for the first time. The UI does not allow you to set it when you attempt to open a gradle project by opening the build.gradle file.
The JDK is usually set in File > Project Structure > etc > etc.... but There is no File menu on Mac IntelliJ on its first run. This is a bug. But I could not find out how to file a bug on YouTrack. So instead I'm putting it here.
My solution was to create a dummie project solely so I could get the File > Project Structure menu. Set the JDK in there. Then close and delete that, then open the build.gradle and then my set JDK were selectable in the project open wizard.
Please sign in to leave a comment.
You can access project structure from the welcome screen using the keyboard shortcut or this menu:
Though, it's still a usability problem. What problems did you encounter when filing a bug at https://youtrack.jetbrains.com/issues/IDEA?
Please note that similar bug report is already present, feel free to vote: https://youtrack.jetbrains.com/issue/IDEA-161765.
Thanks!! I voted that bug up.
Hmm, looking at YouTrack right now, right at the top I see the Create Issue button. I didn't see that before. I wonder if it perhaps wasn't there before because my account was brand new. Or perhaps I didn't make the account until I decided to post to the forum.
Yes, in order to create issues in YouTrack you need to be logged in with the JetBrains Account.
error : not build project java for mac catalina 10.15.6
Did you try to click the link and set the valid JDK for Gradle?
Yes. i am click load JDK for Gradle. This not work
@Maae Y could you please file an issue at https://youtrack.jetbrains.com/issues/IDEA or a support request with the screenshots, showing your actions (when you click and the result you see) and IDE logs zipped (please use Help | Collect Logs and Diagnostic Data action)? Thank you.
I faced the same issue and found a workaround. My project had a gradle.properties that defined org.gradle.java.home on a path that didn't exist on my machine. When I imported this project directly into Idea, I got this issue and couldn't change the Gradle JVM subsequently.
For the workaround, I deleted the project, checked it out from version control again, then modified the org.gradle.java.home property to point to my JDK installation using a text editor. Importing the project after this solved the issue.
>When I imported this project directly into Idea, I got this issue and couldn't change the Gradle JVM subsequently.
Saini Devin could you clarify why wasn't you able to change it?
Did you receive the same "Invalid Gradle JDK Configuration fond" error?
Please note that Gradle JVM which is set via org.gradle.java.home property in gradle.properties has high priority in Gradle itself - it checks this property in different situations, so if it is set invalid it may cause unexpected errors even if Gradle JVM set in IDE in Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Gradle | Gradle JVM option.
When I first imported my project in Idea, I got the "Invalid Gradle JDK Configuration found" error. After this, even if I changed org.gradle.java.home property in gradle.properties to point to the correct JDK location, it didn't matter. Also, the OK button in Build, Execution, Deployment | Build Tools | Gradle | Gradle JVM wasn't clickable, so I couldn't change the JDK from there either.
I think this has something to do while importing the project in Idea. In my project, gradle.properties is part of version control and has org.gradle.java.home defined which is at a different location than my JDK. When I fixed this path in a text editor and then imported the project, then it all worked fine.
>In my project, gradle.properties is part of version control and has org.gradle.java.home defined which is at a different location than my JDK.
IDE uses org.gradle.java.home (if defined) to set the Gradle JVM.
>Also, the OK button in Build, Execution, Deployment | Build Tools | Gradle | Gradle JVM wasn't clickable, so I couldn't change the JDK from there either.
Sounds like https://youtrack.jetbrains.com/issue/IDEA-244779. Which IDE version do you use? This issue has been fixed in 2020.2
I'm using 2020.1, I'll upgrade to 2020.2. Thanks.
I'm using 2021.1 on Ubuntu 20.04, and I still get the "found invalid Gradle JVM configuration" warning when opening a project that has org.gradle.java.home set to a custom Java JVM, such as /usr/lib/jvm/adoptopenjdk-8-openj9-amd64, using the ~/.gradle/gradle.properties file as global Gradle configuration.
(I've resorted to using this JVM because I'm memory-strapped, and OpenJ9 works best for me in this situation.)
However, after closing the warning popup, the custom JVM is correctly launched, the code is correctly compiled, and the program runs correctly, despite the message that suggests otherwise. Could it be a false alarm?
Note that this only happens with IDEA, as Android Studio, using the exact same configuration for Gradle, does not show the warning, and Gradle happily compiles the whole project without errors.
Edit: I've decided to set AdoptOpenJDK's OpenJ9 JVM globally for Java 8:
Then, in IDEA:
Settings -> Build, Execution, Deployment -> Build Tools -> Gradle -> Gradle JVM, choose:
1.8 version 1.8.0_292
instead of org.grade.java.home; it's exactly the same JVM, but there's no error message when configured this way.
Hope it helps others!
Thank you for reporting. Looks like a bug. Created the https://youtrack.jetbrains.com/issue/IDEA-269983 issue for this.
Hello team,
This was reported all the way back in 2017 and is still broken in the latest version of IntelliJ on 2022, with Open JDK 8,11 and 17.
Does JetBrains have plans to release a fix for it soon? I makes the setup of first time projects more difficult and it seems like an important bug.
Thanks!
At this moment there is no ETA for the fix on this problem, I'm sorry. As a workaround, please consider disabling Kotlin plugin if you do not use in your projects.