views:

1646

answers:

3

I am working an application with JXL API and when i tried compiling using eclipse IDE, it's working fine and the same is not compiling when i am trying to compile in Command prompt and showing the below exception..

Extract.java:6: cannot access jxl.read.biff.BiffException bad class file: C:\Program Files\Java\jdk1.5.0_01\jre\lib\ext\jxl.jar(jxl/read/biff/BiffException.class)
class file has wrong version 50.0, should be 49.0
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
import jxl.read.biff.BiffException;
                     ^
1 error

EDIT:

I am able to executing using JDK 1.6. Since JDK 1.6 must also be compatible with lower versions, why doesn't it support the class files which were compiled in JDK 1.5.

A: 

Check you class path in eclipse and make sure that its the same class path your compiling to in the command prompt, also check your library imports

JERiv
Yeah i have checked out everything, everything is right. But even i am getting the exception.
i2ijeya
+4  A: 

The library you're using was compiled with Java 6

Your compiler is Java 5 that's why it doesn't understand that format.

To fix it you have to get a 1.5 version of the library or upgrade your compiler to 1.6 I suggest the later.

OscarRyz
Then how it is working in eclipse?
i2ijeya
Oh, that's no mystery - eclipse ships with it's own compiler so you don't even need a jdk. And that compiler is Java6 compliant :)
Andreas_D
+1  A: 
atk