Class File Versions and Java Versions Mapping
Concept: Class File Versions and Java Versions
Purpose:
This note provides a reference for the mapping between Java class file versions and the corresponding Java versions. When compiling Java code, the compiled class files are assigned a version number that corresponds to the version of the Java compiler used. Ensuring compatibility between the Java version used to compile the code and the Java runtime used to execute it is crucial for avoiding runtime errors.
Key Idea:
Java class files are tagged with a version number that indicates which version of the Java compiler was used to create them. The Java runtime environment can only execute class files that were compiled using the same or an earlier version of the Java compiler.
Mapping of Class File Versions to Java Versions:
Class File Version | Java Version | Notes |
---|---|---|
45.0 | Java 1.1 | Initial class file version |
46.0 | Java 1.2 | |
47.0 | Java 1.3 | |
48.0 | Java 1.4 | |
49.0 | Java 5 | Introduced generics |
50.0 | Java 6 | |
51.0 | Java 7 | |
52.0 | Java 8 | |
53.0 | Java 9 | |
54.0 | Java 10 | |
55.0 | Java 11 | LTS (Long-Term Support) |
56.0 | Java 12 | |
57.0 | Java 13 | |
58.0 | Java 14 | |
59.0 | Java 15 | |
60.0 | Java 16 | |
61.0 | Java 17 | LTS (Long-Term Support) |
62.0 | Java 18 | |
63.0 | Java 19 | |
64.0 | Java 20 | |
65.0 | Java 21 | |
66.0 | Java 22 | |
67.0 | Java 23 |
Use Case:
Use this table to determine the class file version associated with a particular Java version when checking for compatibility issues between compiled code and runtime environments.