aspose file tools*
The moose likes Other Open Source Projects and the fly likes RTFTemplate Jar giving Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "RTFTemplate Jar giving "java.lang.UnsupportedClassVersionError: Bad version number in .class file"" Watch "RTFTemplate Jar giving "java.lang.UnsupportedClassVersionError: Bad version number in .class file"" New topic
Author

RTFTemplate Jar giving "java.lang.UnsupportedClassVersionError: Bad version number in .class file"

karthik manick
Ranch Hand

Joined: Aug 25, 2009
Posts: 53
I am using Sourceforge's RTF Template(rtftemplate-1.0.1-b13.jar) to find and replace a text dynamically in an RTF document. But i am getting an error like"java.lang.UnsupportedClassVersionError: Bad version number in .class file" while running my code. I am using JDK 1.5.
Its running fine in JDK1.6 and 7. But i want this functionality in 1.5 as my app is running in 1.5.(I tried other versions too.. But no help).. Am i missing smething?
Please help.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18909
    
    8

No, you aren't missing anything. The compiled code in that JAR file requires Java 6, as you have already guessed.

However you get the source code in the download too, don't you? Then why not just compile that source with your Java 5 compiler?
karthik manick
Ranch Hand

Joined: Aug 25, 2009
Posts: 53
Thanks for your reply. But the jar file has lots of Java files..Should i compile everything and rebuild the Jar? If yes, any easy way is there?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18909
    
    8

Compile all of them and rebuild the jar? Yes, that's what I would try first. (It's possible you may have problems with code which requires Java 6 to compile, so if you encounter that you'll have to do some rewriting.)

I don't understand your question about whether there's an easy way. I'm sure you know how to compile Java code by now; if you don't, then you're just going to run into one problem after another. This is open-source code you're working with here, so you're expected to be able to do simple things like that.
karthik manick
Ranch Hand

Joined: Aug 25, 2009
Posts: 53
My understanding is to load the Java source code into some IDE as a Java project and i have to write my own Ant script to compile and build the jar. Am i correct? If yes, its its a little time consuming process and my question is whether the build script to package jar itself is available somewhere?
harshvardhan ojha
Ranch Hand

Joined: Jul 26, 2007
Posts: 157
    
    1

Karthink you will find pom.xml there, by using maven you can build your project.
karthik manick
Ranch Hand

Joined: Aug 25, 2009
Posts: 53
Thanks clapham and Ojha.. you saved my time..
 
wood burning stoves
 
subject: RTFTemplate Jar giving "java.lang.UnsupportedClassVersionError: Bad version number in .class file"