How to Read Java Class Version
Updated on Jan 8 2024. Actually, we can just use javap -v to get the version information. For example, $ javap -v Main.class Classfile /Users/luke/Developer/Learn/Spring/learn-spring-in-action-v4/chapter1/build/classes/java/main/com/hiwangzi/chapter1/Main.class Last modified Dec 8, 2023; size 1717 bytes SHA-256 checksum f6202b165f5e178e46a5f0d5b31c5112ffe23eb342f0b47afcc7b1084c63eb8a Compiled from "Main.java" public class com.hiwangzi.chapter1.Main minor version: 0 major version: 65 It is more convenient. $ javap -v Main.class | grep version minor version: 0 major version: 65 It is easy enough to read the class file signature and get these values without a 3rd party API....