Bad version number in .class file

Bad version number in .class file

Mainly happened because of running Java class in a lower JDK version but it was compiled in higher JDK version.

 

How to Check Java Class Version

Execute command as below to check java class details.

 

javap -classpath <your class path list> -verbose {CLASS_NAME}

 

Then it will output following information:

public class {CLASS_NAME} extends java.lang.Object implements *

  SourceFile: "CLASS_NAME.java"

  minor version: 0

  major version: 50

  Constant pool:

const #1 = Method       #14.#49;        //  java/lang/Object."<init>":()V

const #2 = class        #50;    //  java/lang/IllegalArgumentException

const #3 = String       #51;    //  value == null

...

...

So we can see the class file is generated by JDK 1.6:

50.0-->1.6

49.0-->1.5

48.0-->1.4

你可能感兴趣的:(Bad version number in .class file)