Error : class file has wrong version 55.0, should be 52.0

Error : class file has wrong version 55.0, should be 52.0

在 运行 我的主程序上出现上述错误。我不确定这可能是什么原因。

在网上的一个页面上,我发现 class 文件是由不同版本的编译器生成的,与当前的 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.

Hibernate 6.0 及更高版本至少需要 Java 11 (https://docs.jboss.org/hibernate/orm/6.0/userguide/html_single/Hibernate_User_Guide.html#_system_requirements)。