This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Need some help. I created a simple servlet from VTC tutorials. The problem i compile the servlet and put it in exact directories mentioned in the tutorial but after deployment of the app(war file) in j2ee web container i am getting this error.
java.lang.UnsupportedClassVersionError: Bad version number in .class file
after googling I came to know this happens due to conflicting versions of java while compiling and running. I am using "C:\Program Files\Java\jdk1.6.0_21" as JDK and "j2eesdk-1_4_03-windows" as the container. Can you please how can i downgrade the JDK path in EV.? How can i match the versions so that i am able to compile.
I am also new one , but as i know, you are eight, that your problem is because of conflicting versions of java.
So you should try ...this as..
You should change the path variable in both in User variable as well as in System variable.....as i think you changed your path only in system variable...so you should change it on both place..
2. copy your jdk 1.4 path from your container whichever is the path and past in path variable in both places.
then open your command prompt again... and try...
i hope it may solve your problem....
But if i am wrong then please forgive me for my unusual suggestion...
Joined: Mar 22, 2005
Arvind Gangwar wrote:But if i am wrong then please forgive me for my unusual suggestion...
Your suggestion is not technically wrong, but using Java SE 1.4 or Java EE 1.4 at this point is just asking for trouble. Both have been obsolete for years, and should be phased out as soon as possible. Certainly no new development should use either (or Java SE 5, actually).
I have faced a similar problem when my eclipse was using jdk 6 and compiling the code in jdk 6. How ever my tomcat was using java 1.5. And at runtime I was getting "Bad version number in .class file" error.