Skip to content

Java Classes

Java Class

Common Extensions: .class

Info
- https://andreabergia.com/blog/2023/07/a-jvm-in-rust-part-2-the-class-files-format/

Structure

Big-endian Ints

:

ClassFile {
    u_int32             magic;
    u_int16             minor_version;
    u_int16             major_version;
    u_int16             constant_pool_count;
    cp_info        constant_pool[constant_pool_count-1];
    u_int16             access_flags;
    u_int16             this_class;
    u_int16             super_class;
    u_int16             interfaces_count;
    u_int16             interfaces[interfaces_count];
    u_int16             fields_count;
    field_info     fields[fields_count];
    u_int16             methods_count;
    method_info    methods[methods_count];
    u_int16             attributes_count;
    attribute_info attributes[attributes_count];
}

Versions of class files

Version 7
Version 8