Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Bad version number in .class file

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 212
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic