View the jdk version of the class file

  1. Prepare the class file to be viewed, this example uses the Tools.class file.

    How to check the jdk version of the class file
  2.  

    Open the class file with Ultra Edit

    How to check the jdk version of the class file
  3.  

    If the display effect is as shown in the figure below, it means that the hexadecimal display is used by default.

    How to check the jdk version of the class file
  4.  

    If it is not in hexadecimal format, it will be displayed in the garbled style as shown in the figure below. At this point, you need to click [Switch to Hex Editing Mode] on the menu.

    How to check the jdk version of the class file
  5.  

    Just look at the first row of data:

    (1) The first 8 bytes CA FE BA BE are fixed.

    (2) The next 4 bytes 00 00 are the minor version number

    (3) The next 4 bytes 00 34 are the version number of JDK (JDK1.8).

     The corresponding relationship between the JDK version numbers is as follows:

          34 (corresponding to decimal 50): JDK1.8

          33 (corresponding to decimal 50): JDK1.7

          32 (corresponding to decimal 50): JDK1.6

          See step 5 for details....

    How to check the jdk version of the class file
  6. 6

    Detailed JDK version correspondence:

          34 (corresponding to decimal 50): JDK1.8

          33 (corresponding to decimal 50): JDK1.7

          32 (corresponding to decimal 50): JDK1.6

          31 (corresponding to 49 in decimal): JDK1.5

      30 (corresponding to 48 in decimal): JDK1.4

      2F (corresponding to 47 in decimal): JDK1.3

      2E (corresponding to decimal 46): JDK1.2

     

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326523477&siteId=291194637