0

I already have checked this IntelliJ gradle project error "Unsupported class file major version 61" and unfortunately it couldn't solve my problem.

I am using Intellij-idea. I check Oracle documentation to find out that Java 15.0.2 is compatible with Gradle version 6.7, still I am receiving Unsupported class major file version 61.

Also I was previously using JDK 17 but then I have uninstalled it, and also set Java_Home to JDK 15.

The details of Gradle version downloaded on my PC

------------------------------------------------------------
Gradle 6.7
------------------------------------------------------------

Build time:   2020-10-14 16:13:12 UTC
Revision:     312ba9e0f4f8a02d01854d1ed743b79ed996dfd3

Kotlin:       1.3.72
Groovy:       2.5.12
Ant:          Apache Ant(TM) version 1.10.8 compiled on May 10 2020
JVM:          15.0.2 (Oracle Corporation 15.0.2+7-27)
OS:           Windows 10 10.0 amd64

The details of JDK am using:

java version "15.0.2" 2021-01-19
Java(TM) SE Runtime Environment (build 15.0.2+7-27)
Java HotSpot(TM) 64-Bit Server VM (build 15.0.2+7-27, mixed mode, sharing)

I have Double checked Project Structure >> Project >> JDK version am using, it is also 15.

I also double checked Settings >> Build Tools >> Gradle >> Gradle JVM which is also 15.

I also double checked gradle >> gradle-wrapper.properties file to see if version is 6.7 there, it was 7.5.1 but I fixed it to 6.7 (saw this upon searching on stackOverflow, i hope it is right way to do this)

distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip

I also changed target and source compatability to 15 as following:

 // Set the JVM compatibility versions
    withType<JavaCompile> {
        sourceCompatibility = "15"
        targetCompatibility = "15"

Despite it all, am still receiving this error. How to fix this?

After updating Intellij to 2023.1.2

  1. Gradle Wrapper properties:

    distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionUrl=https://services.gradle.org/distributions/gradle- 7.6-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists

  2. Plugin & dependencies section:

    plugins { id("java") id("org.jetbrains.intellij") version "1.14.1" }

    group = "com.plugin" version = "1.0-SNAPSHOT"

    repositories { mavenCentral() }

    // Configure Gradle IntelliJ Plugin // Read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html intellij { version.set("2023.1.2") type.set("IC") // Target IDE Platform

     plugins.set(listOf(/* Plugin Dependencies */))
    

    }

    tasks { // Set the JVM compatibility versions withType { sourceCompatibility = "20" targetCompatibility = "20" }

     patchPluginXml {
         sinceBuild.set("221")
         untilBuild.set("231.*")
     }
    
     signPlugin {
         certificateChain.set(System.getenv("CERTIFICATE_CHAIN"))
         privateKey.set(System.getenv("PRIVATE_KEY"))
         password.set(System.getenv("PRIVATE_KEY_PASSWORD"))
     }
    
     publishPlugin {
         token.set(System.getenv("PUBLISH_TOKEN"))
     }
    

    }

  • Doe the issue occur only in IntelliJ IDEA or in the command line Gradle build as well (`./gradlew build`)? There my be some library in your dependencies which targets Java 17. Please provide the full error / steps to reproduce. – CrazyCoder Jun 07 '23 at 16:29
  • FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project thats what i got over running from cmd. which code you asking for? gradle-wrapper.properties or gradle kts? –  Jun 07 '23 at 17:05
  • 1
    Asking for [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). As mentioned, there may be some dependency in your project, which requires Java 17. – CrazyCoder Jun 07 '23 at 17:08
  • i have modified the code in question, you can check it. –  Jun 08 '23 at 13:41
  • basically i updated my version intellij to 2023.1.2, and set JDK SDK etc to 20, and using gradle 7.6 now, now it's saying unsupported class major file version 64. am so done with intellij by now. so am adding an edit "after updating intellij version", check code there –  Jun 08 '23 at 13:49
  • Probably related bug: https://youtrack.jetbrains.com/issue/IDEA-322008/Gradle-build-fails-on-IntelliJ-IDEA-2023.1.2. – CrazyCoder Jun 08 '23 at 14:19
  • The only way it got solved is, using latest intellij version, using latest jdk and using latest gradle version. Maybe it has soething to do with intellij version, as old versions neither let use old gradles nor newer ones. might be some bug or whatever, it was very tiring. –  Jun 08 '23 at 15:17

1 Answers1

0

The only way it got solved is: Updated Intellij to the latest version (2023.1.2) Added Gradle 8.1.1 (latest gradle version yet) Using latest JDK & JVM (20)