Java class version can be obtained from a class binary using javap
javap -verbose Test | grep 'minor\|major'
minor version: 0
major version: 55
Is it possible to know in advance which class version a JDK will produce? java -version
does not show it
java -version
openjdk version "11.0.17" 2022-10-18
Usually related to java.lang.UnsupportedClassVersionError .
Java class major/minor version produced by a JDK can be obtained from java
command as follows
java -XshowSettings:properties -version 2>&1 | grep -E 'java.(class.)?version '
Result
java.class.version = 55.0
java.version = 11.0.17
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.