You can use
javap command to find the compiled version of a class. javap (Java Class File Disassembler) tool is a tool provided with JDK to disassemble class files.
Unix:
Open a terminal and change the working directory to the place where your class is located.
javap -verbose HelloWorld.class| grep "major"
Windows:
Open a command prompt and change the working directory to the place where your class is located.
javap -verbose HelloWorld.class | findstr "major"
E.g.:

Following is the mapping between the major version and the relevant JDK version.
| Major Version | Comipled JDK version |
| 46 | 1.2 |
| 47 | 1.3 |
| 48 | 1.4 |
| 49 | 5 |
| 50 | 6 |
| 51 | 7 |
| 52 | 8 |
No comments:
Post a Comment