How to find the verion number a class compiled with?

Hi,I have a library in a jar file. How can I find the JDK version number whichis used to compile the library?Thanks.
[144 byte] By [wei_jianga] at [2007-11-27 6:03:13]
# 1
use javap -verbose <full-class-name>on the top you'll find the major version:48: java 1.4.249: java 550: java 6[]Message was edited by: S_i_m_u http://blogs.sun.com/sundararajan/entry/thou_shall_know_the_class
S_i_m_ua at 2007-7-12 16:45:42 > top of Java-index,Java Essentials,Java Programming...
# 2

Not so. What is recorded in the class file is the version of the class file - it is not the version of Java that was used to compile the program. You can't tell by looking at the class file what Java version was used for the compilation.

See http://forum.java.sun.com/thread.jspa?threadID=624398&messageID=3791498

ChuckBinga at 2007-7-12 16:45:42 > top of Java-index,Java Essentials,Java Programming...
# 3
Thank for both.I tried javap and got: minor version: 0 major version: 0That meas the version is older than 1.4?Thanks again.
wei_jianga at 2007-7-12 16:45:42 > top of Java-index,Java Essentials,Java Programming...
# 4

> Not so. What is recorded in the class file is the

> version of the class file - it is not the version of

> Java that was used to compile the program. You can't

> tell by looking at the class file what Java version

> was used for the compilation.

well, at least it tells the lowest version of the JDK which "is used to compile the lib"

Message was edited by: S_i_m_u

or lowest version of VM to run it

S_i_m_ua at 2007-7-12 16:45:42 > top of Java-index,Java Essentials,Java Programming...
# 5
I tried a class compiled by 1.4 and a class compiled by 1.5.I got all zero: minor version: 0 major version: 0I run javap which is a part of jdk1.4.2_12Anything wrong from my side?Thanks.
wei_jianga at 2007-7-12 16:45:42 > top of Java-index,Java Essentials,Java Programming...
# 6

> I tried a class compiled by 1.4 and a class compiled

> by 1.5.

> I got all zero:

>

>minor version: 0

> major version: 0

>

> I run javap which is a part of jdk1.4.2_12

> Anything wrong from my side?

>

> Thanks.

Yes. something is wrong. Just open the class file with something that can display hexidecimal data and look at bytes 5 - 8 in the file. They contain the minor:major versions in hex.

ChuckBinga at 2007-7-12 16:45:42 > top of Java-index,Java Essentials,Java Programming...