错误:类文件版本为55.0,应为52.0。

3
在运行主程序时,我遇到了上述错误。我不确定原因是什么。
在网上的一个页面上,我发现类文件是由不同版本的编译器生成的,而当前JDK是不同的。
我删除了.m2文件夹target文件夹中的所有内容,但仍然显示相同的错误。也许我应该删除.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.

你可以展示一下你的 pom.xml 吗? - dan1st
@sp00m 更换为JDK 11解决了这个问题。您可以将其发布为答案,我会将其标记为解决方案。 - dnaiel
1个回答

2

也可以提供一些有关hibernate与jboss的关系的信息。另外,我在JBoss上发现了一些奇怪的事情,例如https://docs.jboss.org/hibernate/core/3.3/reference/en/html/inheritance.html URL可以访问,但是https://docs.jboss.org/hibernate/core/4.0/reference/en/html/inheritance.html无法访问,而4.0是hibernate core的较新版本。我不确定为什么没有添加。 - dnaiel
@dnaiel 来自维基百科的消息,JBoss, Inc.(现在是Red Hat的一部分)聘请了主要的Hibernate开发人员以推进其发展。 关于文档,似乎它们在4.0中更改了URL,请尝试使用https://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html/ch10.html。 - sp00m
那么Hibernate现在是JBoss拥有的吗?而JBoss已经与Red Hat合并了? - dnaiel

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接