0
\$\begingroup\$

LibGDX latest, Ubuntu 20.04, OpenJDK 11, Gradle 6.7.1

Using above systems and first got below error -

Exception in thread "LWJGL Application" java.lang.NoClassDefFoundError: Could not initialize class org.lwjgl.Sys

Tried correcting it by changing below -

api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"

to

api "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"

But now getting -

Could not run phased build action using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-6.7.1-bin.zip'.
Build file '<build.gradle project path>'
Could not compile build file '<build.gradle project path>'.
startup failed:
General error during semantic analysis: Unsupported class file major version 60
java.lang.IllegalArgumentException: Unsupported class file major version 60
    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)

Any help would be appreciated !

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

Sounds like it's using Java 16 (major version 60), which Gradle 6 doesn't support, instead of 11 (major version 55). The latest version you can use with Gradle 6 is Java 15, though bear in mind that's not a long-term support release like 8, 11 and 17 are.

gdx-setup projects do not support Gradle 7 at this time (13 December 2021). If you use the gdx-liftoff setup tool, Gradle 7 and Java 16/17 can be used.

It would probably be a good idea to check the JDK settings in your IDE, though you can uninstall 16 if you don't need it or do sudo update-alternatives --config java to change the system-wide default Java version (note: this won't change JAVA_HOME - see How do I set environment variables? for setting that).

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .