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: 65

Related terms

Taught in

References