Version Numbers of Java Class File Format
In the Java Virtual Machine, class files are assigned a major version number that indicates compatibility with a specific version of the Java platform. A list of major version numbers and their corresponding Java versions is provided in a table.
Java Version | Major Version |
---|---|
23 | 67 |
22 | 66 |
21 | 65 |
20 | 64 |
19 | 63 |
18 | 62 |
17 | 61 |
16 | 60 |
15 | 59 |
14 | 58 |
13 | 57 |
12 | 56 |
11 | 55 |
10 | 54 |
9 | 53 |
8 | 52 |
7 | 51 |
6 | 50 |
5 | 49 |
1.4 | 48 |
1.3 | 47 |
1.2 | 46 |
1.1 | 45 |
1.0.2 | 45 |
Source of the List
The list of major version numbers is derived from the class version, found at byte offset 7 in the class file format. If you attempt to load a class that was compiled for a higher Java version into a runtime with a lower Java version, you will encounter an error indicating an incompatible class version.
Minor Versions
Minor versions are also assigned to class files, but they are not as significant as major versions and typically do not affect compatibility. Minor versions are used to indicate incremental updates within a major version.
For more detailed information, please refer to the following resources:
The above is the detailed content of What Java Version Corresponds to a Specific Class File's Major Version Number?. For more information, please follow other related articles on the PHP Chinese website!