3

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.

2
  • Some version is not correct. This could be a jar file, not the code you compiled. What class are you getting this for? Commented Sep 2, 2011 at 9:52
  • I am trying to run the selenium testcase.I am using junit3 to run the test Commented Sep 2, 2011 at 10:01

2 Answers 2

9

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Worked perfectly after upgrading the JRE, thank you.
1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.