Class file versions

Every class file records the version of the format it uses, and a JVM refuses any class newer than itself. The major version is the Java release plus 44.

Type a major version (such as 61) or paste an UnsupportedClassVersionError message.

The version is bytes 4 to 7 of the file: a two-byte minor version, then a two-byte major version, both big-endian, right after the CAFEBABE magic number. Running a class on an older JVM fails with:

java.lang.UnsupportedClassVersionError: Main has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 61.0

That message says the class needs Java 21 (65) and the JVM is Java 17 (61). The fixes are to run it on a newer JVM, or compile it for the older one with javac --release 17 (or the release setting in Maven and Gradle). --release also checks that you only use the older release's APIs, which -source and -target alone do not.

MajorHexReleaseYearWhat changed in the format
450x002dJava 1.0 / 1.11996–97The original format. Java 1.1 added inner classes (InnerClasses, Synthetic) and Deprecated, without a new version number.
460x002eJava 1.21998strictfp (ACC_STRICT).
470x002fJava 1.32000
480x0030Java 1.42002assert compiles to existing instructions.
490x0031Java 52004Generics (Signature, LocalVariableTypeTable), annotations, enums (ACC_ENUM), varargs, bridge methods, EnclosingMethod; ldc of Class constants.
500x0032Java 62006StackMapTable and the type-checking verifier (with a fallback to the old verifier).
510x0033Java 72011invokedynamic, MethodHandle, MethodType and InvokeDynamic constants, BootstrapMethods. StackMapTable becomes mandatory; jsr and ret are banned.
520x0034Java 8 LTS2014Lambdas (via invokedynamic), default and static interface methods, MethodParameters, type annotations.
530x0035Java 92017Modules: module-info.class, the Module attributes, Module and Package constants. String concatenation moves to invokedynamic.
540x0036Java 102018
550x0037Java 11 LTS2018Nestmates (NestHost, NestMembers) and Dynamic constants.
560x0038Java 122019Preview features: minor version 65535 marks a class that uses them.
570x0039Java 132019
580x003aJava 142020
590x003bJava 152020
600x003cJava 162021Records (the Record attribute).
610x003dJava 17 LTS2021Sealed classes (PermittedSubclasses). ACC_STRICT stops meaning anything: all floating point is strict.
620x003eJava 182022
630x003fJava 192022
640x0040Java 202023
650x0041Java 21 LTS2023Pattern-matching switch, compiled to invokedynamic with SwitchBootstraps; no format change.
660x0042Java 222024
670x0043Java 232024
680x0044Java 242025
690x0045Java 25 LTS2025

The minor version is 0 for every modern class file. Java 1.0 and 1.1 classes used 45.3. Since Java 12, a minor version of 65535 (0xFFFF) means the class uses preview features: only the exact matching JDK will load it, and only with --enable-preview.

The viewer shows the version of any class you drop in, and the samples come compiled with --release 8, 11, 17, 21 and 25 so you can compare. Of the 7,391 classes in JDK 25.0.5's java.base, 1 is version 52 and 7,390 are version 69.

Specification: JVMS §4.1, The ClassFile Structure (table 4.1-A).