java.lang.UnsupportedClassVersionError: Bad version number in .class file?

后端 未结 10 574
逝去的感伤
逝去的感伤 2020-11-22 12:56

I am getting this error when I include an opensource library that I had to compile from source. Now, all the suggestions on the web indicate that the code was compiled in o

相关标签:
10条回答
  • 2020-11-22 13:40

    i solved this problem by changing jre required for server (in my case is tomcat). From Server tab in eclipse, double click on the server (in order to open page for server configuration), click on Runtime environment, then change JRE required

    0 讨论(0)
  • 2020-11-22 13:45

    Another scenario where this could happen is when you are launching an instance of eclipse (for debug etc.) from a host eclipse - in which case, altering the project's level or JRE library on the project's classpath alone doesn't help. What matters is the JRE used to launch the target eclipse environment.

    0 讨论(0)
  • 2020-11-22 13:46

    I also got the same error. Reason for that I was compiling the project using Maven. I had JAVA_HOME pointing to JDK7 and hence java 1.7 was being used for compilation and when running the project I was using JDK1.5. Changing the below entry in .classpath file or change in the eclipse as in the screenshot resolved the issue.

    classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5
    

    or change in the run configuarions of eclipse as

    0 讨论(0)
  • 2020-11-22 13:46

    Always check for the obvious too. I got this error once when I accidently grabbed the wrong resource for the server's add and remove action. It can be easy to overlook.

    0 讨论(0)
提交回复
热议问题