A quick way to get this info is with the javap tool (which comes with the JDK):
javap -verbose MyClass
gives you something like:
The major and minor version are what you want. These are described in the link Joe gave, specifically in footnote 1 - except unfortunately that only covers up through JDK 1.2, the most current release aat the time the JVM spec 2nd edition came out. The most current info is accessible through "Maintenance Infoormation", which eventually leads here. Footnote 1 now reads:
"1 The Java virtual machine implementation of Sun�s JDK release 1.0.2 supports class file format versions 45.0 through 45.3 inclusive. Sun�s JDK releases 1.1.X can support class file formats of versions in the range 45.0 through 45.65535 inclusive. For k ? 2 implementations of version 1.k of the Java 2 platform can support class file formats of versions in the range 45.0 through 44+k.0 inclusive. "
JDK 1.2 uses major version 46 JDK 1.3 uses major version 47 JDK 1.4 uses major version 48 JDK 1.5 uses major version 49 JDK 1.6 uses major version 50
javap ? This is cool. Except that when I tried it on file compiled with 1.4, I have : Compiled from "DoubleComboJSON.java" public class ajax.DoubleComboJSON extends javax.servlet.http.HttpServlet SourceFile: "DoubleComboJSON.java" minor version: 0 major version: 0 Constant pool: ...