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 Problem regarding the .class version Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Problem regarding the .class version" Watch "Problem regarding the .class version" New topic
Author

Problem regarding the .class version

ilias basha
Ranch Hand

Joined: Nov 27, 2008
Posts: 55

When i am building the java project with jre 1.4.2 in windows machine
and porting the jar(java project) into solaris environment where the jdk 1.4.2_19 is installed,
i need to refer this jar file while compiling some other java code, and i am getting the following error in solaris machine( jdk 1.4.2_19 ).

BandData.java:19: cannot access com.servion.BandingApp
bad class file: /usr/appn/HDFC/BandingApp.jar(com/servion/BandingApp.class)
class file has wrong version 49.0, should be 48.0
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
import com.servion.BandingApp;
^
1 error
JAVA CODE IS COMPILED
Exception in thread "main" java.lang.ClassFormatError: The major.minor version '
49.0' is too recent for this tool to understand.
at sun.tools.java.BinaryClass.load(BinaryClass.java:105)
at sun.tools.java.BinaryClass.load(BinaryClass.java:85)
at com.sun.tools.javah.oldjavah.JavahEnvironment.getClass(JavahEnvironme
nt.java:172)
at com.sun.tools.javah.oldjavah.JavahEnvironment.getAllFields(JavahEnvir
onment.java:89)
at com.sun.tools.javah.oldjavah.JNI.write(JNI.java:38)
at com.sun.tools.javah.oldjavah.Gen.run(Gen.java:149)
at com.sun.tools.javah.oldjavah.Main.run(Main.java:174)
at com.sun.tools.javah.oldjavah.Main.main(Main.java:41)
at com.sun.tools.javah.Main.main(Main.java:40)

can anybody help me regarding this.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

Interesting.
How are you building your jar? Command line? Ant? IDE? How are you confirming which JDK is being used? (In Eclipse, for e.g. if you have multiple JDKs installed on your machine you can configure which JDK to use).
What do you get when you run java -version from the command line on your Windows ?


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
ilias basha
Ranch Hand

Joined: Nov 27, 2008
Posts: 55

Actually i am using eclipse and i configured the project with jdk 1.4.2.


Sorry to waste your time, actually i forgot to configure java compiler option in eclipse - java compiler compilance level to 1.5

so i was facing the problem, but which i set it to 1.4 and the application is working fine.


Anyways
Thanks
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

ilias basha wrote:
Sorry to waste your time, actually i forgot to configure java compiler option in eclipse - java compiler compilance level to 1.5


No problem. Happens
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem regarding the .class version