Got one utility that reads bytes from .class file and interpret it:-
try {
String filename = "C:\\pal\\WTP_Workspace\\JavaSocketBridge\\src\\Test.class";
DataInputStream in = new DataInputStream(new FileInputStream(
filename));
int magic = in.readInt();
if (magic != 0xcafebabe) {
System.out.println(filename + " is not a valid class!");
}
int minor = in.readUnsignedShort();
int major = in.readUnsignedShort();
System.out.println(filename + ": " + major + " . " + minor);
in.close();
} catch (IOException e) {
System.out.println("Exception: " + e.getMessage());
}
Here the combination of major and minor version will reveal the java version against which class has been compiled.
Possible major/minor value are :
45.3=1.0
45.3=1.1
46.0=1.2
47.0=1.3
48.0=1.4
49.0=1.5
50.0=1.6
-----Pras----