Class notes -Java foundation documents magic number and version number

Version of the magic number of Class file

Magic number: the first four bytes of each Class file called magic number, its sole function is to determine whether the file is a virtual machine that can be accepted by Class file, many files are stored in this magic number, not to expand the reason is because the name as the identity of the extension can be altered.

Magic values ​​may be makers of file formats are free to choose, as long as the magic value is not widely used at the same time not to cause confusion. The magic number of Class file for CAFEBABE.

Version: followed by four bytes stored magic number is the version number of the Class file byte 5 and 6 is the minor version number, 7 and 8 are the major version number. Java version number is from 45 starts, the large version jdk1.1 after the release of the major version number is incremented up 1 (jdk1.0 ~ 1.1 using 45.0 ~ 45.3), high-energy version jdk backward compatible, but later versions will not run Class file.

Guess you like

Origin blog.csdn.net/helianus/article/details/89329673