• Post Reply Bookmark Topic Watch Topic
  • New Topic

Bad version number in .class file  RSS feed

 
K Sathya Narayanan
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
i am using Tomcat 5.5 web server, eclipse version 3.1.2(Lombaz)

i have
1) Jre1.5.0_06 and
2) Jre1.6.0_03

for Jre1.6.0_03 i have set the classpath , path and java_Home

i am accession a java file from jsp .
it displays the "java.lang.UnsupportedClassVersionError: Bad version number in .class file"

can you tell me what i should do now
can i uninstall Jre1.6.0_03
is tomcat 5.5 not compitable with Jre1.6.0_03
 
sudhir nim
Ranch Hand
Posts: 212
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"java.lang.UnsupportedClassVersionError" is thrown when the class has been compiled using different version of java (i.e when you try to use jdk-5 compiled class in jdk-4).

change the jre in eclipse to 1.6
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat is compatible with both JDK versions.

It sounds as if you are compiling with JDK 1.6, and running the code with JDK 1.5. So changing the JRE in Eclipse (as suggested above) won't solve the problem (it's set to 1.6 already). What you need to do is to compile the code and run it with the same JRE/JDK version. So either switch Eclipse to JDK 1.5, or run Tomcat with JDK 1.6.
 
K Sathya Narayanan
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot


i changed both eclipse and tomcat to 1.5 and recompiled all the class files
and it works correctly
 
sudhir nim
Ranch Hand
Posts: 212
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Either switch Eclipse to JDK 1.5, or run Tomcat with JDK 1.6


Thats wat I wanted to say, I thought that he is already running tomcat with 1.6.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!