Hi Everyone, I've written a webapplication, which has one html file and one servlet.In the html file if i click a button then the servlet is called.there i'm getting an error like
javax.servlet.ServletException: Error allocating a servlet instance
rootcause:java.lang.UnsupportedClassVersionError: Bad version number in .class file
Why do i get such sort of error can anyone help me out???
I'm compiling servlet file using jdk1.6 and my server is installed with jdk1.5 is this the reason for getting tht error?? let me know if soo.... Thanks, Sandhya.
Originally posted by Sandhya Deekonda: I'm compiling servlet file using jdk1.6 and my server is installed with jdk1.5 is this the reason for getting tht error?? let me know if soo.... Thanks, Sandhya.
Yes, re-compile the class with the following switch: -source 1.5
Yes, re-compile the class with the following switch: -source 1.5
Why is it so ? is this issue about compatibility or is about difference in generated JDK 1.5 or JDK 6 class file.. If it is then what is the major difference between these class files.
Why is it so ? is this issue about compatibility or is about difference in generated JDK 1.5 or JDK 6 class file.. If it is then what is the major difference between these class files.
Thanks in Advance..
A JRE can't be expected to interpret a class file that was compiled with a future version of javac. The source switch is the compiler's way of telling the JRE that there are no features in this class file that aren't compatible with the JRE. The compiler will enforce this by blowing up if you try to compile source code that has features that weren't present in the named version.
Sorry Ben i'm new 2 this forum.Atlast i got it. I uninstalled my jdk6.0 and installed jdk5.0 now its working.i was in the process of uninstalling and installing so i couldn't respond fastly.Thanks alot. Thanks, Sandhya.