2

I have an ear app with two EJB and one WEB (war) projects all using compiler compliance 1.5. In my web project I created a utility Class file that takes a byte array of an xml file and returns some string values using the vtd-xml library v2.10 and I instantiate an object of this class in a servlet. At the call of the constructor of the object (that takes a byte array) I get the error:

java.lang.UnsupportedClassVersionError: Bad version number in .class file

When I remove all vtd-xml related objects from the class I do not get this error. Any advice would be appreciated.

Regards

Alex
  • 616
  • 1
  • 12
  • 28

4 Answers4

3

It sounds like the vtd-xml jar file has classes in it that are 1.6

Kal
  • 24,724
  • 7
  • 65
  • 65
2

The documentation says:

Thrown when the Java Virtual Machine attempts to read a class file and determines that the major and minor version numbers in the file are not supported.

The library you are using must have been compiled with a different version of Java.

Jeremy
  • 22,188
  • 4
  • 68
  • 81
2

you can recompile using the build.bat file (included with vtd-xml.zip) to obtain a new vtd-xml.jar.

vtd-xml-author
  • 3,319
  • 4
  • 22
  • 30
2

Now it works executing build.bat file (included with vtd-xml.zip) but you need to edit the target version to 1.5 instead of 1.6

Alvarock
  • 17
  • 1