4.8. Format Checking

When a prospective class file is loaded (§5.3) by the Java Virtual Machine, the Java Virtual Machine first ensures that the file has the basic format of a class file (§4.1). This process is known as format checking. The first four bytes must contain the right magic number. All recognized attributes must be of the proper length. The class file must not be truncated or have extra bytes at the end. The constant pool must not contain any superficially unrecognizable information.

This check for basic class file integrity is necessary for any interpretation of the class file contents.

Format checking is distinct from bytecode verification. Both are part of the verification process. Historically, format checking has been confused ...

Get The Java® Virtual Machine Specification, Java SE 7 Edition, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.