Hello, How (if possible) can determine the compiler used to compile a
specific Java .class file?
Thanks, - Dave
"." - 26 May 2005 18:59 GMT
> Hello, How (if possible) can determine the compiler used to compile a
> specific Java .class file?
It is possible for a java compiler to add an attribute to the CLASS file
format but there is nothing in the specifications to guarantee there is
any information about the compiler used to create the CLASS file.

Signature
Send e-mail to: darrell dot grainger at utoronto dot ca
Lucy - 26 May 2005 21:17 GMT
> Hello, How (if possible) can determine the compiler used to compile a
> specific Java .class file?
>
> Thanks, - Dave
Maybe you mean what version of the compiler.
In the class file, the first 4 bytes are fixed.
The next 4 bytes give you a number that is related
somehow to the version. e.g. here is the first line
of output from 'od -x' on a file (octal dump in hex format):
0000000000 FECA BEBA 0000 2E00 2D00 000A 000A 0813
If you flip the bytes, you see 'CAFEBABE' which identifies
the file as a java class file. The next 2 are '0000' then '002E'
The 002E is 46 in decimal and it is the "major" part of the version.
The 0000 is the "minor" part. You need to check this, but
major/minor
45/03 java 1.0.2
46/00 java 1.1
48/00 java ???