File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark ""Bad version number in .class file"" Watch ""Bad version number in .class file"" New topic
Author

"Bad version number in .class file"

Joe Goble
Greenhorn

Joined: Jul 29, 2009
Posts: 7
I've tried everything and I am getting absolutely no where. I'm building a dynamic web project, I need to build using Java 1.5 because I'm limited to Tomcat 5.5. I added this Jar to access a movie database: http://sourceforge.net/projects/jtmdb/. Building is fine, but when I load a page that imports the class I get a nasty 500 error. Here is my error from loading localhost:8080/tmdb-test/test.jsp


My Jave home environment variable is: C:\Program Files\Java\jdk1.5.0_22
My path variable for Java is set to: %JAVA_HOME%\bin;
My classpath environment variable is not set.
My project facet for Java is set to: 1.5
In Eclipse preferences -> Java -> Installed JRE's -> I have jdk1.5.0_22 checked
In Eclipse preferences -> Java -> Compiler -> I have Compiler compliance level set to 1.5

I think I know what the problem is. The Jar I added was built using 1.6, and it's complaining because I'm trying to run it using 1.5. I don't know how to get around this, though. Is there a way to check what version Jar's are made for? Is there a way to downgrade? Is this even the issue? I've tried importing different classes from the Jar into my JSP and I get similar errors. I'm also not sure if this is just a Tomcat issue. Thanks for the help!
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11508
    
  95

Joe Goble wrote:I need to build using Java 1.5 because I'm limited to Tomcat 5.5.

Joe Goble wrote:I think I know what the problem is. The Jar I added was built using 1.6, and it's complaining because I'm trying to run it using 1.5. I don't know how to get around this, though.

Run using Java 6? Tomcat 5 works quite happily on top of JDK 6.
Joe Goble
Greenhorn

Joined: Jul 29, 2009
Posts: 7
My bad, my web host actually limits me to JDK 1.5.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61648
    
  67

Then you will need to build using JDK 1.5.

Your javac compiler may have a switch to compile in 1.5 mode, I don;t know for sure.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Joe Goble
Greenhorn

Joined: Jul 29, 2009
Posts: 7
Wow, thank you. Bear, I'm not sure if this is exactly what you meant, but it put me in the right direction. I downloaded the source to the Jar and just added the classes to my project. It's working great now.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39828
    
  28
What you have done is re-compile with Java6, I suspect.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: "Bad version number in .class file"