When JVM tries to load a class and found that class
file version is not supported it throws UnSupportedClassVersionError.
It generally occurs if a higher jdk version is used to
compile the source file and lower jdk version is used to run the program.
Example:
If you compile your java source file in jdk1.6 and try to run it on jdk 1.5,
JVM will throw "java.lang.UnsupportedClassVersionError: Bad version number
in .class file".
How to fix UnSupportedClassVersionError?
· Try to compile source code of that jar with the same JDK version which we are using to run the program (if source is available).
· If you don't have source try to find the
compatible version of that library.
· Increase the jre version that is used to run
the program.
I faced this problem while running an application on
Web application on Eclipse and Tomcat. This is because there was version
difference of Eclipse and Tomcat (lower jdk version in Tomcat).
I changed jre version of Tomcat to fix this
problem.
No comments:
Post a Comment