Unsupported class file major version 65 for MODDING minecraft

A problem occurred configuring root project 'Create-Dreams-and-Desires'.
Could not open cp_proj generic class cache for build file 'Documents\GitHub\Create-Dreams-and-Desires\build.gradle' (C:\Users\boyer\.gradle\caches\8.1.1\scripts\2syfweab3xuu0ujb3fh9i3opi).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 65
  > Unsupported class file major version 65

After having every the universe of possibilities problem, as I am completly new about doing java, github, gradlew. Now that succeeded to compile a wrong branch from the github this minecraft mod (for game version 1.19). I got the right branch (for game version 1.20.1) and… voila…

PLEASE, tell me what to do, I know its a java version problem, I didnt got this problem with another mod for the same version

You try to run a Gradle 8.1.1 build using Java 21, this is not supported.
https://docs.gradle.org/current/userguide/compatibility.html#java_runtime
Either upgrade Gradle or downgrade Java.

Ok, I compared the 2 mod, both use java 21, the one working use gradle 7.5, I want to downgrade gradle from 8.1.1 to 7.5, I tried by command (./gradlew wrapper --gradle-version 7.5), I have the same damn origin error.
Please how I downgrade it ?

You can just edit the gradle-wrapper.properties, but making it worse will not help you.
Did you look at the link I supplied?

Thank you.
I fixed it by changing java home in terminal like this : setx /m JAVA_HOME “PATHTOTHEJDKFOLDER”
Its the jdk 17 eclipse termurin.
but Its something to change again if needed…

But another problem of course, I recloned the same github project (its containing gradlew), its insta crashing…

FAILURE: Build failed with an exception.

* What went wrong:
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.

Error occurred during initialization of VM
Could not reserve enough space for 3145728KB object heap <- I have 32Gb

by following links, nothing fix that of course.

./gradlew --status
No Gradle daemons are running.
   PID STATUS   INFO
 36444 STOPPED  (by user or operating system)
 34244 STOPPED  (by user or operating system)
  2200 STOPPED  (by user or operating system)
 22392 STOPPED  (by user or operating system)
553252 STOPPED  (by user or operating system)
121440 STOPPED  (by user or operating system)
 71316 STOPPED  (by user or operating system)

Please what doe that ???

That means this build is configured to use 3 GiB of RAM for the Gradle daemon, and even though you might have 32 GiB in total, there is currently not enough RAM free to reserve these 3 GiB.

I forgot to tell that I tried with 5Gb, I just tried further with 9Gb, I felt it wasnt the problem bcs 3Gb is fairly enought for a small mod. This is not fixing, this issue doesnt have any damn sense.

You misread.
The problem is that you request too much.
Your OS has not enough free RAM to fulfill that configured value.

It has enought available ram, I looked about it. Actually I have 10Gb free.

I found a way: reputted the previous java home (oracle jdk 21) > emptied recycle bin (full of my mess of same exact file/folder left at the exact same location) > recloned > EVERYTHING WORK FINE NOW, AND WITH JAVA 21… HOW

No need to shout at me, I’m just trying to help you. >:-(
The error message says you do not have enough RAM.
Why it works now with Java 21 I can hardly guess, maybe you are not using Java 21 although you think you do, or maybe you use a newer Gradle version now, or maybe you right now do not trip the incompatible part. :man_shrugging: