File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Unsuccessfull build due to wrong version 49.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Unsuccessfull build due to wrong version 49.0" Watch "Unsuccessfull build due to wrong version 49.0" New topic
Author

Unsuccessfull build due to wrong version 49.0

Sverre Moe
Ranch Hand

Joined: Jul 10, 2007
Posts: 109
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
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35223
    
    7
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.


Android appsImageJ pluginsJava web charts
Sverre Moe
Ranch Hand

Joined: Jul 10, 2007
Posts: 109
I am using other jars in my 1.4 project that is compiled with the same 1.5 version withouth Maven complaining about them.
Mark Smyth
Ranch Hand

Joined: Feb 04, 2004
Posts: 288
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.


SCJP<br />SCJD
Sverre Moe
Ranch Hand

Joined: Jul 10, 2007
Posts: 109
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.
 
I agree. Here's the link: jrebel
 
subject: Unsuccessfull build due to wrong version 49.0
 
Similar Threads
class file has wrong version 50.0, should be 49.0
HFSJ Jsp Compilation - Status 500 error message
Absent Line Number Information - I'm NOT using Ant
jre compiling error
debugging with ANT