• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Unsuccessfull build due to wrong version 49.0

 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to build a project with Java 1.4.2_08 with Maven2, but I receive an error like:
"cannot access ClassName"
"Bad class file: C:\Path\to\alibrary.jar (ClassName)"
class file has wrong version 49.0, should be 48.0

There has been made sure that the code does not contain any Java 1.5 spesifics.

The alibrary.jar i included in another project which I build with maven2 using Java 1.4.2_08, but I receive no problem there.

alibrary.jar har defined in the MANIFEST.MF a Java 1.5 version (I have no control over this).

My projects must be compiled with 1.4
 
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The code of the library may not contain any Java 5-specific code, but if it has been compiled by a Java 5 compiler without specifying Java 1.4 as the target, then the class file version will indicate that it is Java 5 code.

If it's an open source library, see if there's a Java 1.4-compatible version, or build one yourself. Check the "-source" and "-target" switches of javac on how to do that.

If it's a commercial library, then the vendor should be able to supply a 1.4-compatible version.
 
Sverre Moe
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using other jars in my 1.4 project that is compiled with the same 1.5 version withouth Maven complaining about them.
 
Ranch Hand
Posts: 288
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the classes in the jar have been compilled using java version 1.5 then any code compilled using java 1.4 or less will not be able to call any classes in the jar. You need to get a 1.4 version of this jar file.
 
Sverre Moe
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Mark Smyth:
If the classes in the jar have been compilled using java version 1.5 then any code compilled using java 1.4 or less will not be able to call any classes in the jar. You need to get a 1.4 version of this jar file.



Yes I can understand that, but some other projects I have "downgraded" to 1.4 also include som external libraries compiled with 1.5 and those do not give the same version error.

The Maven POM has defined maven-compiler-plugin source and target to 1.4 and all dependencies has a scope of "compile". I tried to include the external jar I had trouble with in another project and got the same problem with it.

I just find it strange. I have looked at other jar files that are compiled with 1.5(Defined in MANIFEST.MF) that gives me no trouble. Strange that this one should.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic