Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List of Java class file format major version numbers?

Tags:

java

version

I saw this list of major version numbers for Java in another post:

  • Java 1.2 uses major version 46
  • Java 1.3 uses major version 47
  • Java 1.4 uses major version 48
  • Java 5 uses major version 49
  • Java 6 uses major version 50
  • Java 7 uses major version 51
  • Java 8 uses major version 52
  • Java 9 uses major version 53
  • Java 10 uses major version 54
  • Java 11 uses major version 55
  • Java 12 uses major version 56
  • Java 13 uses major version 57
  • Java 14 uses major version 58
  • Java 15 uses major version 59
  • Java 16 uses major version 60
  • Java 17 uses major version 61

Where does this list come from? Is there a specific reference for this? Preferably something that shows minor versions too?

like image 776
Robert Mark Bram Avatar asked Feb 07 '12 04:02

Robert Mark Bram


People also ask

What is a class file version?

A Java class file is a file (with the .class filename extension) containing Java bytecode that can be executed on the Java Virtual Machine (JVM).

What version of Java is 52?

minor version 52.0, the class is compiled using JDK 8 since major version 52 corresponds to Java SE 8.

What is major and minor version in Java?

A Java class file holds the Java bytecode for a Java class that can be executed on a Java virtual machine (VM). Encoded at the beginning of a class file is a major and minor version number of the class file format that is used in it. This major. minor number indicates which Java VM can execute this class file.

How many versions are there in Java?

There are four platforms of the Java programming language: Java Platform, Standard Edition (Java SE) Java Platform, Enterprise Edition (Java EE) Java Platform, Micro Edition (Java ME)


2 Answers

These come from the class version. If you try to load something compiled for java 6 in a java 5 runtime you'll get the error, incompatible class version, got 50, expected 49. Or something like that.

See here in byte offset 7 for more info.

Additional info can also be found here.

like image 88
Michael Avatar answered Sep 30 '22 00:09

Michael


I found a list of Java class file versions on the Wikipedia page that describes the class file format:

http://en.wikipedia.org/wiki/Java_class_file#General_layout

Under byte offset 6 & 7, the versions are listed with which Java VM they correspond to.

like image 41
Peter Avatar answered Sep 30 '22 00:09

Peter