错误:类文件版本错误 55.0,应为 52.0
在运行我的主程序时,我收到上述错误。我不确定这可能是什么原因。
在网上的一个页面上,我发现类文件是由不同版本的编译器生成的,并且当前的 JDK 不同,
我删除了 .m2 文件夹 和 target< 中的所有内容/strong> 文件夹,但仍然显示相同的错误。不确定我是否也应该删除 .idea 文件夹并检查。
应该有某种方法可以在不更改为 Java 11 的情况下解决它。
这就是确切的错误 -
java: cannot access org.hibernate.Session
bad class file: /C:/Users/name/.m2/repository/org/hibernate/orm/hibernate-core/6.0.0.CR1/hibernate-core-6.0.0.CR1.jar!/org/hibernate/Session.class
class file has wrong version 55.0, should be 52.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
On running my main program I am getting the above error. I am not sure what could be the reason for this.
On one of the pages online I found that the class files have been generated by a different version of the compiler and the current JDK is different
I deleted everything inside the .m2 folder and the target folder, but still, it showed the same error. Not sure maybe I should delete the .idea folder too and check.
There should be some way to resolve it without changing to Java 11.
This is the exact error -
java: cannot access org.hibernate.Session
bad class file: /C:/Users/name/.m2/repository/org/hibernate/orm/hibernate-core/6.0.0.CR1/hibernate-core-6.0.0.CR1.jar!/org/hibernate/Session.class
class file has wrong version 55.0, should be 52.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Hibernate 6.0 及更高版本至少需要 Java 11 (https://docs.jboss.org/hibernate/orm/6.0/userguide/html_single/Hibernate_User_Guide.html#_system_requirements)。
Hibernate 6.0 and later versions require at least Java 11 (https://docs.jboss.org/hibernate/orm/6.0/userguide/html_single/Hibernate_User_Guide.html#_system_requirements).