By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,541 Members | 1,105 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,541 IT Pros & Developers. It's quick & easy.

How to determine Java bytecode version

P: n/a
Howdy,

I'm trying to figure out what bytecode version a given class was
compiled with. I've tried looking at the actual .class file, but that
didn't pan out.

Is there a utility to determine versions?

thanks!

Sam
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

"Samuel Jackson" <sa**********@hotmail.com> wrote in message
news:22**************************@posting.google.c om...
Howdy,

I'm trying to figure out what bytecode version a given class was
compiled with. I've tried looking at the actual .class file, but that
didn't pan out.

Is there a utility to determine versions?


Every '.class' file starts off with the following:

* Magic Number [4 bytes]
* Version Information [4 bytes]

A hexdump of a '.class' file compiled with each of the following options
reveals:

javac -target 1.1 ==> CA FE BA BE 00 03 00 2D
javac -target 1.2 ==> CA FE BA BE 00 00 00 2E
javac -target 1.3 ==> CA FE BA BE 00 00 00 2F
javac -target 1.4 ==> CA FE BA BE 00 00 00 30

Perhaps you could use this information to write your own '.class' file
version checking utility, using Java, or perhaps a scripting or shell
language ;) !

I hope this helps.

Anthony Borla

P.S.

If requiring more information just do a Google search for ".class file
format" or "Java Bytecode Tutorial"
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.