I recommend removing the JDK definition by re-importing the project, going to the second page of the import wizard and emptying the “java home” line.
Instead, define the Java home that Gradle should use in your <userHome>/.gradle/gradle.properties using org.gradle.java.home=.... This way it will be the same both from the command line and the IDE.