Are there any Java APIs to find out the JDK version a class file is compiled for? Of course there is the javap tool to find out the major version as mentioned in here. Howev
This gets you the contents of the class file:
MysteryClass.class.getResourceAsStream("MysteryClass.class")
Then look at bytes 5-8 to get the minor and major version. A mapping between those numbers and the JDK releases can be found here.