9.1 class File Header

9.1 class File Header

DumpClass prints three columns. The left column is an offset, in hex, into the file. The middle column is the bytes at that location, also presented in hex. The right column is the interpretation of the bytes.

The class file begins by identifying itself as a class file and providing some version information:

 000000 cafebabe       magic = ca fe ba be 000004 0003           minor version = 3 000006 002d           major version = 45 

The first four bytes of any class file, taken as a 32-bit unsigned integer, are 3,405,691,582, or (in hex) CAFEBABE. This is the "magic number" that makes it easy to quickly reject anything that is not a class file. Most of the numbers in the class file are treated as unsigned integers, unless stated otherwise.

The next two bytes are the major and minor versions of the class file format. The proper values are 45 for the major version and 3 for the minor version for JVMs before platform 2. The Java 2 platform accepts versions from 45.3 to 46.0, inclusive.



Programming for the Java Virtual Machine
Programming for the Javaв„ў Virtual Machine
ISBN: 0201309726
EAN: 2147483647
Year: 1998
Pages: 158
Authors: Joshua Engel

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net