Welcome, please login or register

How to determine Java version from .class file

The first 4 bytes is the magic number CAFEBABE. Then comes 2 bytes with the minor version and then the major version.

The major version number means:
J2SE 6.0 = 50 (0×32 hex),
J2SE 5.0 = 49 (0×31 hex),
JDK 1.4 = 48 (0×30 hex),
JDK 1.3 = 47 (0×2F hex),
JDK 1.2 = 46 (0×2E hex),
JDK 1.1 = 45 (0×2D hex).

For example if the byte code Hex starts with

CAFEBABE00000032

it means it is J2SE 6

For more details see http://en.wikipedia.org/wiki/Class_(file_format)

Leave a Reply