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.
| Major | Hex | Release | Year | What changed in the format |
|---|---|---|---|---|
| 45 | 0x002d | Java 1.0 / 1.1 | 1996–97 | The original format. Java 1.1 added inner classes (InnerClasses, Synthetic) and Deprecated, without a new version number. |
| 46 | 0x002e | Java 1.2 | 1998 | strictfp (ACC_STRICT). |
| 47 | 0x002f | Java 1.3 | 2000 | |
| 48 | 0x0030 | Java 1.4 | 2002 | assert compiles to existing instructions. |
| 49 | 0x0031 | Java 5 | 2004 | Generics (Signature, LocalVariableTypeTable), annotations, enums (ACC_ENUM), varargs, bridge methods, EnclosingMethod; ldc of Class constants. |
| 50 | 0x0032 | Java 6 | 2006 | StackMapTable and the type-checking verifier (with a fallback to the old verifier). |
| 51 | 0x0033 | Java 7 | 2011 | invokedynamic, MethodHandle, MethodType and InvokeDynamic constants, BootstrapMethods. StackMapTable becomes mandatory; jsr and ret are banned. |
| 52 | 0x0034 | Java 8 LTS | 2014 | Lambdas (via invokedynamic), default and static interface methods, MethodParameters, type annotations. |
| 53 | 0x0035 | Java 9 | 2017 | Modules: module-info.class, the Module attributes, Module and Package constants. String concatenation moves to invokedynamic. |
| 54 | 0x0036 | Java 10 | 2018 | |
| 55 | 0x0037 | Java 11 LTS | 2018 | Nestmates (NestHost, NestMembers) and Dynamic constants. |
| 56 | 0x0038 | Java 12 | 2019 | Preview features: minor version 65535 marks a class that uses them. |
| 57 | 0x0039 | Java 13 | 2019 | |
| 58 | 0x003a | Java 14 | 2020 | |
| 59 | 0x003b | Java 15 | 2020 | |
| 60 | 0x003c | Java 16 | 2021 | Records (the Record attribute). |
| 61 | 0x003d | Java 17 LTS | 2021 | Sealed classes (PermittedSubclasses). ACC_STRICT stops meaning anything: all floating point is strict. |
| 62 | 0x003e | Java 18 | 2022 | |
| 63 | 0x003f | Java 19 | 2022 | |
| 64 | 0x0040 | Java 20 | 2023 | |
| 65 | 0x0041 | Java 21 LTS | 2023 | Pattern-matching switch, compiled to invokedynamic with SwitchBootstraps; no format change. |
| 66 | 0x0042 | Java 22 | 2024 | |
| 67 | 0x0043 | Java 23 | 2024 | |
| 68 | 0x0044 | Java 24 | 2025 | |
| 69 | 0x0045 | Java 25 LTS | 2025 |
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).