.class file parser is the original and most mature format in Binary Internals. It was first published as the standalone “Java Class Viewer” project and was renamed and merged into Binary Internals in April 2021. The parser implements the full JVM ClassFile structure as defined in the Java Virtual Machine Specification and supports every class file version from JDK 1.0.2 through Java 25 (major version 69). When you open a .class file, Binary Internals validates the magic number 0xCAFEBABE, determines the Java SE release from the major/minor version pair, and builds an interactive tree covering every field in the file.
File Extension
.class — registered by PluginDescriptorClass which returns ["class"] from getExtensions().
ClassFile Structure
The parser models the JVM specification’sClassFile structure exactly. Field names in the source code match the specification names:
What the Parser Exposes
1
Magic Number
The first four bytes must equal
0xCAFEBABE. The parser reads them as a u4 field named magic and throws FileFormatException if the value does not match java.lang.classfile.ClassFile.MAGIC_NUMBER. This value is shown in the tree as magic: CAFEBABE.2
Version (major_version / minor_version)
Two When
u2 fields immediately follow the magic number. The major version determines the minimum JDK required to load the class. The parser calls ClassFileFormatVersion.fromMajor(major_version) to resolve the human-readable Java SE release name.minor_version is 65535 and major_version is 56 or above, the class uses preview features for that release. The parser surfaces this through isPreview() and includes it in getVersionText(), for example: 69.0 (Java SE 25, preview features).3
Constant Pool
constant_pool_count (u2) gives the number of entries. The parser reads constant_pool_count - 1 cp_info items starting at index 1. The ConstantType.parse() method dispatches each entry by its tag byte. CONSTANT_Long and CONSTANT_Double entries occupy two consecutive indices; the parser handles this automatically.Supported constant types include: CONSTANT_Utf8, CONSTANT_Integer, CONSTANT_Float, CONSTANT_Long, CONSTANT_Double, CONSTANT_Class, CONSTANT_String, CONSTANT_Fieldref, CONSTANT_Methodref, CONSTANT_InterfaceMethodref, CONSTANT_NameAndType, CONSTANT_MethodHandle, CONSTANT_MethodType, CONSTANT_Dynamic, CONSTANT_InvokeDynamic, CONSTANT_Module, and CONSTANT_Package.4
Class Declaration
Four
u2 fields follow the constant pool:access_flags— a bitmask ofACC_PUBLIC,ACC_FINAL,ACC_SUPER,ACC_INTERFACE,ACC_ABSTRACT,ACC_SYNTHETIC,ACC_ANNOTATION,ACC_ENUM, andACC_MODULE.this_class— index into the constant pool pointing to aCONSTANT_Class_infothat names this class.super_class— index to the superclassCONSTANT_Class_info, or0forjava.lang.Objectandmodule-info.interfaces_countfollowed byinterfaces[interfaces_count]— constant pool indices of implemented interfaces.
5
Fields
fields_count (u2) is followed by fields_count field_info structures. Each field_info contains its own access_flags, name_index, descriptor_index, attributes_count, and attributes array.6
Methods
methods_count (u2) is followed by methods_count method_info structures with the same layout as fields. When you click a code: byte codes node in the tree (the Code attribute of a method), an additional Opcode tab appears showing disassembled JVM bytecode.7
Attributes
attributes_count (u2) is followed by attributes_count attribute_info structures at the class level. The parser dispatches each attribute by its name string (resolved from attribute_name_index in the constant pool). Class-level attributes include SourceFile, InnerClasses, BootstrapMethods, Module, NestHost, NestMembers, Record, PermittedSubclasses, and others defined in the JVM specification.JVM Version Reference
ThegetVersionText() method produces a string in the format <major>.<minor> (<Java SE release>). All major version values from JDK 1.0.2 through Java 25:
If a class file carries a major version not known to the running JDK (for example, a future version),
getVersion() returns Optional.empty() and getJavaSEText() returns "unknown Java SE version".Class File Verification
TheClassFile class exposes a verify() method that runs the JDK’s built-in ClassFile API verifier against the parsed bytes. It returns a Verification record containing two lists:
errors— actual verification failures.unresolved— classes that could not be found during verification (incomplete but not necessarily wrong).
summary() helper returns "passed", "N error(s)", or "incomplete, N class(es) not found".
Verification requires that the class file’s dependencies (superclasses, interfaces, referenced types) are resolvable. Binary Internals attempts to locate them relative to the opened file’s directory using its package path, but unresolved types are reported separately from hard errors.
Tree Tabs
When a node is selected in the Binary Internals viewer, additional tabs may appear in the content panel:History
The original Java Class Viewer (published at CodeProject) was renamed and merged into Binary Internals in April 2021. All prior functionality is preserved; the class file parser is now one plugin among many in the unified viewer.