This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi i am referring the HFS servlets and jsp.. My question is that i have done the example in the 3rd chapter successfully on one pc but unable to do it on the other pc with the same softwares i.e.tomcat 5.5 and jdk 1.6.0 ..(on windows) The error i m gating is for the first version of the servlet... Though the browser is showing the form.html when i select the color and hit submit the error i get is:
HTTP Status 500 -
type Exception report
description The server encountered an internal error () that prevented it from fulfilling this request.
java.lang.UnsupportedClassVersionError: Bad version number in .class file
It looks like you have compiled your code with one version of Java and are trying to run it with another earlier version. Check which versions of the JDK you use to compile your code and run your servlet container. [ August 08, 2008: Message edited by: Paul Sturrock ]
Originally posted by rakesh kadulkar: no friend i m using the same code compiled with the same version as i have installed jdk 1.6.0 today itsele and doing every thing now... So no chances of happening what you said
Well, I'm afraid that is what is happening. Classes get their version number from the compiler, so your code is definitely being compiled by a version of the JDK that is not the same as the version you are running your servlet container in.
Check your build path. Check how you start your servlet container. How do both these things find the version of Java to use?
Here is another root. It looks like you are using Tomcat. In Tomcat's bin directory there should be an executable with a w in the name, like tomcat6w.exe. Use that to get at the Tomcat service monitor. Select the Java tab and it will tell you what Java Virtual Machine is being used to run the servlet container in.
Press the [...] button next to the JVM path and select the one that you used to compile your code.
If you have a different server or start Tomcat through an IDE you will have to read their documentation to figure out how to change the JVM used by the server.