英文:
Class file has wrong version 55.0, should be 52.0 (IntelliJ)
问题
在尝试在IntelliJ中编译Maven项目时,最初遇到了以下错误:
错误:java: 无效的源发布:11
然后,我开始尝试遵循这里提供的一些解决方案:<https://stackoverflow.com/questions/25878045-errorjava-invalid-source-release-8-in-intellij-what-does-it-mean/26009627#26009627>
我之前的项目是在Java 8中开发的,因此在更改SDK、语言级别、JRE等为Java 8后,我遇到了这个错误:
错误的类文件。类文件的版本为55.0,应为52.0
我知道这实际上是在说类文件是Java 11的,应该是8的,但是否还有其他可能在尝试使用Java 11的地方我遗漏了?我甚至已经卸载了Java 11,但仍然得到相同的错误。
英文:
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: <https://stackoverflow.com/questions/25878045/errorjava-invalid-source-release-8-in-intellij-what-does-it-mean/26009627#26009627>
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.
答案1
得分: 1
我在使用Maven编译项目时,在命令行上出现了“class file has wrong version 55.0,should be 52.0”的错误,而我的Java版本设置为8/1.8。我相信CrazyCoder在问题的评论中是正确的,这与所使用的库/类有关。通过将我的Java版本切换到11,我成功编译了这个项目。
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论