Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caused by: BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 66 #1302

Open
UdoW opened this issue Apr 9, 2024 · 4 comments

Comments

@UdoW
Copy link

UdoW commented Apr 9, 2024

When I change the Gradle version to 8.7 then Buildship marks the Gradle build file with a red icon and in the Problems View I can see this error:

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

Expected Behavior

Buildship should accept the correct build file. When calling Gradle in the console then no errors are shown.

Current Behavior

See above.

Context

Eclipse Version:
Version: 2024-03 (4.31.0)
Build id: 20240307-1437
JustJ: Version: 22.0.0.v20240322-1225
Buildship: 3.1.9.v20240115-1636

I use the wrapper which uses Gradle 8.7. The environment contains a Java 17 and JAVA_HOME is set to Java 17.

@UdoW UdoW added the a:bug 🪲 label Apr 9, 2024
@reinsch82
Copy link
Contributor

We appreciate the effort, but we must ask for more information so that we can triage it.

  • Does the problem persist if you restart Eclipse?
  • Can you try another JDK like OpenJDK. There where issues in the past that only happend with JustJ.

We do not see an immediate root cause, and we need a minimal reproducible example for the triage. If we have a reproducer, we may be able also to suggest workarounds or ways to avoid the problem.

The ideal way to provide a reproducer is to leverage our reproducer template. You can also use Gradle Project Replicator to reproduce the structure of your project.

Thank you for your help.

@UdoW
Copy link
Author

UdoW commented Apr 10, 2024

I found a solution:

If the Eclipse is run by a Java 17 JRE e.g. JustJ 17 then the Gradle buildscript can be compiled and the error disappears.

If the Eclipse is run by a Java 22 JRE like it is run in my bug report (see above) then I get the exception and Eclipse/Buildship cannot compile the script and therefore no tasks could be run from within Eclipse.

It definitivly depends on JRE version with which Eclipse is run. If it has the same version as the Gradle CLI version (PATH variable and JAVA_HOME) then everything works fine.

@oleosterhagen
Copy link
Contributor

As you have already found out, Gradle cannot run with Java 22 yet (see Compatibility Matrix). When you do not want to change the JRE for running Eclipse, try if changing the Java version in the preferences helps:

Window > Preferences: Gradle > Advanced Options: Java home

@arawak
Copy link

arawak commented May 21, 2024

I've been wrestling with this same error tonight. I only had one JDK (17) installed, but forgot that Spring Tool Suite bundles a JDK, which is specified in the SpringToolSuite.ini with the -vm option.

Even though I had selected the external JDK, and removed the built-in one from Preferences->Installed JREs, Eclipse was still running with the bundled JDK21.

Removing the -vm argument from the ini file and restarting did the trick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants