Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2005

Tip: Looking for answers? Try searching our database.

Determine compliler from .class file?

Thread view: 
laredotornado@zipmail.com - 26 May 2005 16:17 GMT
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 ???


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.