(Really an extended comment than an answer ..)
The question was regarding "where does the list of versions come from".
That was answered in this response, which references the JAVA SE Specification on: "The class
File Format". Seems that's pretty authoritative (it's also referenced in the Wiki for the byte 6 (major version) values) and should be the accepted answer.
Several answers seem to focus on how to determine the value using javap
or not using it. Those should be separate questions. Nevertheless, a non- javap
means of finding the version is unix command file
. file
reads the magic
, which is specified in the ClassFile structure.
ie: file myClass.class
, or more elegantly, file -b myClass.class | awk -F',' '{print $NF}'
eg:
$ find * -name "*.class" -exec file -b {} \; | awk -F',' '{print $NF}' | sort -u
version 45.3
version 50.0 (Java 1.6)
version 52.0 (Java 1.8)
javap -verbose MyClass
? – Pazpaza