Java Bytecode Version: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Internal=
=Internal=
* [[Java_Bytecode#Determine_Bytecode_Version_in_a_Class|Java Bytecode]]
* [[Java_Bytecode#Java_Bytecode_Version|Java Bytecode]]
* [[Gradle_Java_Plugin#Use_a_Specific_Java_Version|Specifying a bytecode version in Gradle]]
 
=Overview=
=Overview=
A valid class file starts with <code>0xcafebabe</code>, followed by the minor version as unsigned short, followed by the major version, as unsigned short.
A valid class file starts with <code>0xcafebabe</code>, followed by the minor version as unsigned short, followed by the major version, as unsigned short.


{|class="wikitable" style="text-align: left;"
{|class="wikitable" style="text-align: left;"
| a ||
! Java Version
! Bytecode Version
|-
| 1.0 || 45.0
|-
| 1.1 || 45.3
|-
| 1.2 || 46.0
|-
| 1.3 || 47.0
|-
| 1.4 || 48.0
|-
| 5 || 49.0
|-
| 6 || 50.0
|-
| 7 || 51.0
|-
| 8 || 52.0
|-
| 9 || 53.0
|-
| 10 || 54.0
|-
| 11 || 55.0
|-
| 12 || 56.0
|-
| 13 || 57.0
|-
| 14 || 58.0
|-
| 15 || 59.0
|-
| 16 || 60.0
|-
| 17 || 61.0
|-
|-
|}
|}

Latest revision as of 19:14, 12 June 2021

Internal

Overview

A valid class file starts with 0xcafebabe, followed by the minor version as unsigned short, followed by the major version, as unsigned short.

Java Version Bytecode Version
1.0 45.0
1.1 45.3
1.2 46.0
1.3 47.0
1.4 48.0
5 49.0
6 50.0
7 51.0
8 52.0
9 53.0
10 54.0
11 55.0
12 56.0
13 57.0
14 58.0
15 59.0
16 60.0
17 61.0

Playground

The following project produces a bytecode-version.jar that reads the bytecode version from a Java class:

https://github.com/ovidiuf/playground/tree/master/java/bytecode/bytecode-version/README.md