Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid JDK configuration found, while importing a project via Gradle

I have installed IntelliJ and I need to import a Gradle project.

I have build the gradle project using command prompt with the gradlew build command.

At the IntelliJ welcome page, I have proceeded with proper instructions, and when I choose "Finish". I get the following error:

Invalid Gradle JDK configuration found. Open Gradle Settings JAVA_HOME ennvironment variable not set.

When I click on "Open Gradle Settings" it pop up with error of Not found with a path under IntelliJ directory in Program files and searching in jre/jre/bin/....etc.

like image 991
Sanuj Avatar asked Sep 18 '15 14:09

Sanuj


People also ask

What version of Java is gradle using?

Gradle can only run on Java version 8 or higher. Gradle still supports compiling, testing, generating Javadoc and executing applications for Java 6 and Java 7.

What is a gradle in Java?

Gradle is a build automation tool for multi-language software development. It controls the development process in the tasks of compilation and packaging to testing, deployment, and publishing. Supported languages include Java (as well as Kotlin, Groovy, Scala), C/C++, and JavaScript.


1 Answers

Deleting .gradle and .idea will likely solve the problem.

So:

  • Close the project
  • Go to the project dir and delete .gradle and .idea
  • Get back and re-open the project using the IDE

These two must be generated locally on your PC and not pulled from a remote or somewhere else (Also they should be in .gitignore).

In my case the reason was that these two folders were generated on another computer and I had opened a project with these two folders existing before.

like image 120
Mahdi-Malv Avatar answered Oct 20 '22 04:10

Mahdi-Malv