Pages Navigation Menu

Coding is much easier than you think

How to find the JDK target version from a .class file?

How to find the JDK target version from a .class file?

 
This tutorial gives a tip to find out the JDK compiler target version from a .class file
 

javap -verbose YourJavaClass

 

On running the above command in command prompt, it displays the major version number, based on which the JDK Compiler version can be determined.
 
Below are some example values:
 

JDK 1.0 -> major version 45
JDK 1.1 -> major version 45
JDK 1.2 -> major version 46
JDK 1.3 -> major version 47
JDK 1.4 -> major version 48
JDK 5   -> major version 49
JDK 6   -> major version 50
JDK 7   -> major version 51

 

About Mohaideen Jamil