look for that on google and u'll find more
CAFEBABE is a magic word for a class file. as u might observe it is consisting of only hex letters. if the class file doesn't have this magic word then it is not a valid class file (well i'm myself little unsure about this on various systems Windows/Linux/Unix as magic word is used by mostly Unix based systems so i donno if Windows jvm cares about CAFEBABE or not)...
Originally posted by O. Subramaniam:
where this magical word will be stored, can v read this word?
Best option is to try out yourself. I found out from the net that "CAFEBABE" are
the starting bytes of each and every java class files.
So here is the program to find out the truth.
If we run this program using the command
we see that the first bytes are indeed "CAFEBABE".
Originally posted by Roy Tock:
Hmmm... under Windows, using cygwin's "od -t x2 blah.class" to show me what's in the file, I get "feca beba".
Not nearly as cool sounding as CAFEBABE.
[ August 14, 2003: Message edited by: Roy Tock ]
May be because of platform encoding or with cygwin?
As you can see, if you reverse the hex words we get "CAFEBABE" again.
[ August 18, 2003: Message edited by: Allan Deshpande ]