List of Java class file format major version numbers?

ID : 10463

viewed : 25

Tags : javaversionjava

Top 5 Answer for List of Java class file format major version numbers?

vote vote


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.

vote vote


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

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

vote vote


Official source for major version number:

Java Virtual Machine Specification, Chapter 4. The class File Format

The latest published version of the JVM spec can be found here.

vote vote


If you're having some problem about "error compiler of class file", it's possible to resolve this by changing the project's JRE to its correspondent through Eclipse.

  1. Build path
  2. Configure build path
  3. Change library to correspondent of table that friend shows last.
  4. Create "jar file" and compile and execute.

I did that and it worked.

vote vote


If you have a class file at build/com/foo/Hello.class, you can check what java version it is compiled at using the command:

javap -v build/com/foo/Hello.class | grep "major" 

Example usage:

$ javap -v build/classes/java/main/org/aguibert/liberty/Book.class | grep major   major version: 57 

According to the table in the OP, major version 57 means the class file was compiled to JDK 13 bytecode level

Top 3 video Explaining List of Java class file format major version numbers?