10

Originally, when trying to compile the maven project in IntelliJ, I got the following error:

Error:java: invalid source release: 11

I then began by following some of the solutions here: Error:java: invalid source release: 8 in Intellij. What does it mean?

The previous projects I worked on were in Java 8, so after changing SDKs, language levels, JREs, etc. to Java 8, I have gotten this error:

Bad class file. class file has wrong version 55.0, should be 52.0

I know this is essentially saying the class file is Java 11 and should be 8, but is there anything else I am missing that could still possibly be trying to use Java 11? I even uninstalled Java 11, but am still getting the same error.

mortimerfreeze
  • 199
  • 1
  • 1
  • 9
  • When do you get the "Bad class file" error? – CrazyCoder Aug 28 '20 at 20:05
  • When trying to build. – mortimerfreeze Aug 28 '20 at 20:39
  • 2
    This project seems to use some library/classes that are compiled with Java 11 and will not work with Java 8. Does it help if you change the project SDK to 11? – CrazyCoder Aug 28 '20 at 20:39
  • I uninstalled it but it was previously set to 11 and I got the "invalid source release: 11" error. – mortimerfreeze Aug 28 '20 at 20:55
  • Please share the [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). – CrazyCoder Aug 28 '20 at 21:40
  • Having the same issue since i upgraded intelliJ to 2020.3 !! its like Android team and intelliJ team dont talk to each other! now intelliJ wants android 11 to compile my project but Android only works on 8! once you upgrade to 11, Android gives javax.xml.bind.JAXBException err! – kevoroid Dec 08 '20 at 09:36

1 Answers1

1

I got the class file has wrong version 55.0, should be 52.0 on the command line when compiling a project with Maven while my Java was set to version 8/1.8. I believe CrazyCoder was correct in the comments to the question that it had to do with the libraries/classes being used. I managed to compile the project by switching my Java version to 11.

Ward Muylaert
  • 545
  • 4
  • 27