Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ Gradle Could not Determine Java Version

I'm using IntelliJ to work with a Gradle project. I noticed that whenever I try to refresh the Gradle project (or when trying to import/re-import a project as a Gradle project) I get the following error:

Error: Could not determine the Java version

$JAVA_HOME is set, the SDK is set to Java 8 (and gradle -version confirms it is also is set to Java 8), and the project builds fine from the command line. Restarting IntelliJ also does nothing. I also deleted the project specific and global .gradle folders, which did not resolve the issue.

I am running IntelliJ 14.1.4 on Ubuntu 15.04 and Gradle 2.5.

EDIT: Tried it on a different machine (also Ubuntu 15.04, Oracle Java 8) running IntelliJ 14.1.1 and it worked correctly.

like image 520
ahjohnston25 Avatar asked Aug 28 '15 15:08

ahjohnston25


People also ask

Could not determine Java version from 17.0 1 Gradlew?

You need to downgrade you java to work with gradle . UPDATED: As gradle version 7.3 released at 5th Nov 2021 , It will now provide support to Java 17. So you either upgrade to 7.3 gradle version or downgrade your java version .

How do I check my Java version in gradle?

Gradle doesn't expose any specific API for this but you can simply check the 'java. version' system property from the settings. gradle file. We actually do, it's ['JavaVersion'](http://www.gradle.org/docs/current/javadoc/org/gradle/api/JavaVersion.html).

Is gradle compatible with Java 11?

Android Gradle plugin requires Java 11 to run.


2 Answers

I had this problem too. It seems it was linked to the project being setup with a rather old gradle build. Changing distributionUrl to a new distribution in /gradle//wrapper/gradle-wrapper.properties solved it

like image 192
MGH Avatar answered Sep 22 '22 13:09

MGH


You should try to switch Idea boot jdk. It works for me.

like image 40
Tymur Yarosh Avatar answered Sep 26 '22 13:09

Tymur Yarosh