class file version
The number stored in every class file that records which Java release it targets, so an older JVM can refuse a file from the future.
In more detail
The major version is the feature release plus 44: Java 17 writes 61 and Java 21 writes 65. A JVM that meets a higher number than it supports fails with UnsupportedClassVersionError, the usual sign that a library or build targeted a newer Java than the one running it. javap -v shows the number.
Example
javap -v Hello | grep major # major version: 65Related terms
- class file — The file javac writes for each class, holding that class's bytecode plus a description of its fields and methods.
- --release flag — The javac option that compiles for an older Java release, checking against that release's library and writing its class file version.
- javap — The JDK tool that prints what a class file contains, including its bytecode with -c and its class file version with -v.
Taught in
- Release Trains And Long Term Support — Modern Java: Virtual Threads & High-Throughput Services