Issue
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.
Solution
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).
Answered By - sp00m
Answer Checked By - Marilyn (JavaFixing Volunteer)