(VS Code) Gradle: Build error

My comment: I’m a new one here, I don’t even know Java and I just wanted to learn how to make mods. I do not understand any professional phrases. Please, try to speak common language.

Here what vs says:

[error] FAILURE: Build failed with an exception.

* What went wrong:

Could not open cp_init generic class cache for initialization script 'C:\Users\User\AppData\Local\Temp\4ca0310e44c3192955ad604dac04aa6f114c391b83a407df36ac8297ac759eb2.gradle' (C:\Users\User\.gradle\caches\8.4\scripts\27i0zvrd9o4i4vfyq69ciy4sb).

> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 66

* Try:

> Run with --stacktrace option to get the stack trace.

> Run with --info or --debug option to get more log output.

> Run with --scan to get full insights.

> Get more help at https://help.gradle.org.

CONFIGURE FAILED in 14s

[error] [gradle-server] The supplied build action failed with an exception.

[error] Error getting build for d:\versions\Mod\mods\forge-1.20.2-48.1.0-mdk: The supplied build action failed with an exception.

[info] Java Home: C:\Program Files\Java\jdk-22

[info] JVM Args: --add-opens=java.base/java.util=ALL-UNNAMED,--add-opens=java.base/java.lang=ALL-UNNAMED,--add-opens=java.base/java.lang.invoke=ALL-UNNAMED,--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens=java.base/java.nio.charset=ALL-UNNAMED,--add-opens=java.base/java.net=ALL-UNNAMED,--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED,-Xmx3G,-Dfile.encoding=UTF-8,-Duser.country=UA,-Duser.language=uk,-Duser.variant

[info] Gradle User Home: C:\Users\User\.gradle

[info] Gradle Version: 8.4

[error] FAILURE: Build failed with an exception.

* What went wrong:

Could not open cp_init generic class cache for initialization script 'C:\Users\User\AppData\Local\Temp\4ca0310e44c3192955ad604dac04aa6f114c391b83a407df36ac8297ac759eb2.gradle' (C:\Users\User\.gradle\caches\8.4\scripts\27i0zvrd9o4i4vfyq69ciy4sb).

> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 66

* Try:

> Run with --stacktrace option to get the stack trace.

> Run with --info or --debug option to get more log output.

> Run with --scan to get full insights.

> Get more help at https://help.gradle.org.

CONFIGURE FAILED in 409ms

[error] [gradle-server] The supplied build action failed with an exception.

[error] Error getting build for d:\versions\Mod\mods\forge-1.20.2-48.1.0-mdk: The supplied build action failed with an exception.

[info] Found 0 tasks

[info] Java Home: C:\Program Files\Java\jdk-22

[info] JVM Args: --add-opens=java.base/java.util=ALL-UNNAMED,--add-opens=java.base/java.lang=ALL-UNNAMED,--add-opens=java.base/java.lang.invoke=ALL-UNNAMED,--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens=java.base/java.nio.charset=ALL-UNNAMED,--add-opens=java.base/java.net=ALL-UNNAMED,--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED,-Xmx3G,-Dfile.encoding=UTF-8,-Duser.country=UA,-Duser.language=uk,-Duser.variant

[info] Gradle User Home: C:\Users\User\.gradle

[info] Gradle Version: 8.4

[error] FAILURE: Build failed with an exception.

* What went wrong:

Could not open cp_init generic class cache for initialization script 'C:\Users\User\AppData\Local\Temp\4ca0310e44c3192955ad604dac04aa6f114c391b83a407df36ac8297ac759eb2.gradle' (C:\Users\User\.gradle\caches\8.4\scripts\27i0zvrd9o4i4vfyq69ciy4sb).

> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 66

* Try:

> Run with --stacktrace option to get the stack trace.

> Run with --info or --debug option to get more log output.

> Run with --scan to get full insights.

> Get more help at https://help.gradle.org.

CONFIGURE FAILED in 154ms

[error] [gradle-server] The supplied build action failed with an exception.

[error] Error getting build for d:\versions\Mod\mods\forge-1.20.2-48.1.0-mdk: The supplied build action failed with an exception.

[info] Found 0 tasks

[info] Java Home: C:\Program Files\Java\jdk-22

[info] JVM Args: --add-opens=java.base/java.util=ALL-UNNAMED,--add-opens=java.base/java.lang=ALL-UNNAMED,--add-opens=java.base/java.lang.invoke=ALL-UNNAMED,--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens=java.base/java.nio.charset=ALL-UNNAMED,--add-opens=java.base/java.net=ALL-UNNAMED,--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED,-Xmx3G,-Dfile.encoding=UTF-8,-Duser.country=UA,-Duser.language=uk,-Duser.variant

[info] Gradle User Home: C:\Users\User\.gradle

[info] Gradle Version: 8.4

[error] FAILURE: Build failed with an exception.

* What went wrong:

Could not open cp_init generic class cache for initialization script 'C:\Users\User\AppData\Local\Temp\4ca0310e44c3192955ad604dac04aa6f114c391b83a407df36ac8297ac759eb2.gradle' (C:\Users\User\.gradle\caches\8.4\scripts\27i0zvrd9o4i4vfyq69ciy4sb).

> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 66

* Try:

> Run with --stacktrace option to get the stack trace.

> Run with --info or --debug option to get more log output.

> Run with --scan to get full insights.

> Get more help at https://help.gradle.org.

CONFIGURE FAILED in 193ms

[error] [gradle-server] The supplied build action failed with an exception.

[error] Error getting build for d:\versions\Mod\mods\forge-1.20.2-48.1.0-mdk: The supplied build action failed with an exception.

[info] Found 0 tasks

The error means you use Java 22 to run a Gradle 8.4 build which is not supported: Compatibility Matrix