简体   繁体   中英

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

I am getting the follwing error while running selenium testcase.

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

I have checked all the versions of java in eclispse and they are correct.

Please it would be greatful if you can help me out.

UnsupportedClassVersionError occurs typically when you have .class (typically in .jar-file) that has been compiled with higher version of java than virtual machine trying to run it. For example you have a .class-file that is compiled with JDK 6 and you are trying to run it with 1.4 JVM.

Check your PATH variable and test java -version command etc. Also check this thread for couple typical issues that cause this problem.

This error is due to mismatch in your Java Versions. Follow the following steps

  • Type Regedit in run and navigate to HKEY_LOCAL_MACHINE\\Software\\JavaSoft\\Java Runtime Environment\\
  • See the version number mentioned in the registry
  • Download the same version and place it in your computer
  • Set JAVA_HOME to the jdk directory in environment variables
  • Add %JAVA_HOME%\\bin;%JAVA_HOME%\\jre\\bin to the path variable

Now check again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM