Found Invalid Gradle JVM configuration

Answered

Hello all,

When I created a Gradle project so that I could use coroutines in Kotlin I got told that 

JDK 14.0.1 isn't compatible with Gradle 6.1.1

Please fix JAVA_HOME environment variable

 

I am using IDEA

IntelliJ IDEA 2020.1.2 (Community Edition)
Build #IC-201.7846.76, built on June 1, 2020
Runtime version: 11.0.7+10-b765.53 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.

 

Also main/src and main/test were not created. There may be other missing directories too, but I'm new to this so I'm not sure.

So, presumably I upgrade Gradle to a version that is compatible with JDK14. I can download the latest version and install it, but how do I tell IDEA where to look for it.

I assume that I can create the missing directories manually.

Thanks for any help.

2
8 comments

> When I created a Gradle project so that I could use coroutines in Kotlin I got told that
JDK 14.0.1 isn't compatible with Gradle 6.1.1
Please fix JAVA_HOME environment variable

Most probably the updating to the latest IDE version will help you to handle such issues automatically.

See the issues for more details:

> So, presumably I upgrade Gradle to a version that is compatible with JDK14. I can download the latest version and install it, but how do I tell IDEA where to look for it.

You can specify the Gradle location in (Preferences | Build, Execution, Deployment | Build Tools | Gradle) settings.

0
Avatar
Permanently deleted user

Thanks for getting back to me.

Unfortunately upgrading to the latest version did not work for me, as I was using the latest version!  I had originally downloaded 2020.1.1 (Win64), but it had upgraded itself to 2020.1.2 (I vaguely remember doing this).

I have now both downloaded Gradle 6.5 and intalled it.

I could not find Preferences so I went to File | New Project Settings | Settings for New Projects | Build, Execution, Deployment | Build Tools | Gradle and changed Gradle user home to the location of Gradle 6.5

When I created a Gradle project I got the same incompatibility error, so the change in New Project Settings was not the right one.

For the project, in File | Settings | Build, Execution, Deployment | Build Tools | Gradle

Use Gradle from is set to Gradle wrapper properities file, and

Gradle JVM is set to no SDK

I changed Use Gradle from to the location of Gradle 6.5 and Gradle JVM to 14.  A daemon ran and appeared to be successful, but still no src directory.

I created the src/main/kotlin directories and a very simple kotlin test file that worked correctly.

Any further advice on what to do to to get the wizard to work correctly would be gratefully received. 

2

Thanks for the detailed information!

> Any further advice on what to do to get the wizard to work correctly would be gratefully received.

Can you try to install JDK 11 on your machine? IntelliJ IDEA will automatically use it for running Gradle when creating the project.

0

how will Intellij automatically use something other than env `JAVA_HOME` jdk?

I manually installed Gradle 6.5, updated env `GRADLE_HOME` and `GRADLE_BIN`  but there is no setting to stop Intellij from automatically using Gradle 6.1.1 that it uses the Gradle wrapper to arrive at this incompatibility?

Edit, ok in Settings/Build/Gradle I set "Use gradle from..." to env GRADLE_HOME and "Gradle JVM" to the env JAVA_HOME and it looks like it's working. Sorry

0

how will Intellij automatically use something other than env JAVA_HOME jdk?

The Gradle JVM version will be based on the detected SDKs on your machine. We have an internal algorithm that allows scanning several locations on your machine to find all installed JDKs. The IDE will scan it and use the most compatible version. Most likely, in your case, the IDE cannot find a compatible version because only JDK 14 is installed.

Unfortunately upgrading to the latest version did not work for me, as I was using the latest version! I had originally downloaded 2020.1.1 (Win64), but it had upgraded itself to 2020.1.2 (I vaguely remember doing this).

It seems like you have installed the release version. The fix is included in the 2020.2 EAP version (Build #IU-202.5792.28). You may try to download it from our confluence page.

1
Avatar
Permanently deleted user

Everytime you create a new Gradle/ Maven project make sure your are connected to the internet.
Otherwise the project will be created but with no sum directories

0

Hi, this problem is still going on

0

I had originally downloaded 2020.1.1 (Win64), but it had upgraded itself to 2020.1.2 (I vaguely remember doing this).

The current latest version is 2022.3 please update to this version.

I could not find Preferences so I went to File | New Project Settings | Settings for New Projects | Build, Execution, Deployment | Build Tools | Gradle and changed Gradle user home to the location of Gradle 6.5

This is not scorrect. Gradle user is not the same as the Gradle installation. The Gradle use home is where additional information like caches/dependencies are stored. Please remove this location and leave the default.

0

Please sign in to leave a comment.