Error in load Main class
Closed this issue · 1 comments
code:
package net.felsstudio;
import com.raylib.java.Raylib;
import com.raylib.java.core.Color;
public class Main {
public static void main(String[] args) {
final int SCREEN_WIDTH = 800;
final int SCREEN_HEIGHT = 250;
Raylib rl = new Raylib();
rl.core.InitWindow(SCREEN_WIDTH,SCREEN_HEIGHT,"Simple window");
rl.core.SetTargetFPS(60);
while(!rl.core.WindowShouldClose()){
rl.core.BeginDrawing();
rl.core.ClearBackground(Color.RAYWHITE);
rl.text.DrawText("Congrats! You created your first window!", 190, 200, 20, Color.LIGHTGRAY);
rl.core.EndDrawing();
}
}
}
I use Java 17 and SDK version 17
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/raylib/java/Raylib has been compiled by a more recent version of the Java Runtime (class file version 62.0), this version of the Java Runtime only recognizes class file versions up to 61.0
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:862)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
at net.felsstudio.Main.main(Main.java:10)
This is because Raylib-J is built targeting Java versions 1.8 and higher.
To resolve this error complie your project with a Java 1.8 JDK or newer