-1

So I am simply following this instructions: https://docs.gradle.org/current/samples/sample_building_java_applications.html

Just initialized a project with

gradle init

choosing application project and defaults.

When I run ./gradlew build I can't:

> startup failed:
  General error during conversion: Unsupported class file major version 62
  
  java.lang.IllegalArgumentException: Unsupported class file major version 62
        at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:196)
        at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:177)
        at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:163)
        at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:284)
        at org.codehaus.groovy.ast.decompiled.AsmDecompiler.parseClass(AsmDecompiler.java:81)
        at org.codehaus.groovy.control.ClassNodeResolver.findDecompiled(ClassNodeResolver.java:251)
        at org.codehaus.groovy.control.ClassNodeResolver.tryAsLoaderClassOrScript(ClassNodeResolver.java:189)
...

My java --version is

openjdk 18-ea 2022-03-22
OpenJDK Runtime Environment (build 18-ea+36-Ubuntu-1)
OpenJDK 64-Bit Server VM (build 18-ea+36-Ubuntu-1, mixed mode, sharing)

and javac --version is java-18-ea.

Is there something I can fix to be able to build?

  • When you run: ' gradle init its the default gradle in your system, see which one it is by : ' gradle --version When you run ./gradlew build its the one in your current directory. try command : ./gradlew --version also can give command gradle build Basically the error points to some classes being built with a higher version of java then gradle is using or configured to be using so also see the properties in the build.gradle and gradle.properties to know what version of java is being used to compile and build your project. – tgkprog May 18 '22 at 15:40
  • 2
    After `gradle init` both my system's and project's gradle's version were the same: 7.2. I changed the project version to 7.4 and afterwards it build successfully. I assume that gradle version was not compatible with my java version. – Peter Gassendi May 18 '22 at 15:48

0 Answers0