List of Java class file format major version numbers?

By | July 12, 2018
Questions:

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

References:

https://blogs.oracle.com/darcy/entry/source_target_class_file_version
https://en.wikipedia.org/wiki/Java_class_file#General_layout

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.

Questions:
Answers:

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.

Leave a Reply

Your email address will not be published. Required fields are marked *