Gradle – Could not target platform: ‘Java SE 8’ using tool chain: ‘JDK 7 (1.7)’

We Are Going To Discuss About Gradle – Could not target platform: ‘Java SE 8’ using tool chain: ‘JDK 7 (1.7)’. So lets Start this Java Article.

Gradle – Could not target platform: ‘Java SE 8’ using tool chain: ‘JDK 7 (1.7)’

  1. Gradle – Could not target platform: 'Java SE 8' using tool chain: 'JDK 7 (1.7)'

    This is what worked for me (Intellij Idea 2018.1.2):
    1) Navigate to: File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle
    2) Gradle JVM: change to version 1.8
    3) Re-run the gradle task

  2. Gradle – Could not target platform: 'Java SE 8' using tool chain: 'JDK 7 (1.7)'

    This is what worked for me (Intellij Idea 2018.1.2):
    1) Navigate to: File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle
    2) Gradle JVM: change to version 1.8
    3) Re-run the gradle task

Solution 1

This is what worked for me (Intellij Idea 2018.1.2):

1) Navigate to: File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle

2) Gradle JVM: change to version 1.8

3) Re-run the gradle task

Original Author Mahesh Of This Content

Solution 2

For IntelliJ 2019:

Intellij IDEA -> Preferences -> Build, Execution, Deployment -> Build Tools -> Gradle -> Gradle JVM

Select correct version.

Original Author François Gaudin Of This Content

Solution 3

For IntelliJ 2019, JDK 13 and gRPC:

Intellij IDEA -> Preferences -> Build, Execution, Deployment -> Build Tools -> Gradle -> Gradle JVM

and Select correct version.

you might also have to adding below line in your build.gradle dependencies

compileOnly group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.2'

Original Author Aheza Desire Of This Content

Solution 4

Finally I imported my Gradle project. These are the steps:

  1. I switched from local Gradle distrib to Intellij Idea Gradle Wrapper
    (gradle-2.14).
  2. I pointed system variable JAVA_HOME to JDK 8 (it was 7th previously) as I had
    figured out by experiments that Gradle Wrapper could process the
    project with JDK 8 only.
  3. I deleted previously manually created file gradle.properties (with
    org.gradle.java.homevariable) in windows user .gradle directory
    as, I guessed, it didn’t bring any additional value to Gradle.

Original Author Aheza Desire Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

Siddharth

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment