Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
karthik manick
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21298
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21298
32
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 157
1
Android Java MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Karthink you will find pom.xml there, by using maven you can build your project.
 
karthik manick
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks clapham and Ojha.. you saved my time..
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic