Java version of class file

Java version of class file

If you want to determine the Java version of a class file, you have to check the major version number. A good and detailed explanation of the general layout of a class file can be found on wiki. Java is shipped with javap, the Java class file disassembler. The javap command disassembles class files and outputs the class information (MD5 checksum, methods, fields, minor version, major version, …).

macOS

javap -verbose YourClass.class | grep major

Windows

javap -verbose YourClass.class | findstr major

Java versions

major version number Java version
54 Java SE 10
53 Java SE 9
52 Java SE 8
51 Java SE 7
50 Java SE 6.0
49 Java SE 5.0
48 JDK 1.4
47 JDK 1.3
46 JDK 1.2
45 JDK 1.1

Florian Schmidt

Senior Java EE Software Engineer, Swift Enthusiast, Techie, Managing Partner Sneed IT UG, Founder Smipty