This post is mostly just speculation. If you want the actual answer for why CAFEBABE was chosen, james gosling himself actually gave an answer
As far as I know, I'm the guilty party on this one. I was totally unaware of the NeXT connection. The small number of interesting HEX words is probably the source of the match. As for the derivation of the use of CAFEBABE in Java, it's somewhat circuitous:
We used to go to lunch at a place called St Michael's Alley. According to local legend, in the deep dark past, the Grateful Dead used to perform there before they made it big. It was a pretty funky place that was definitely a Grateful Dead Kinda Place. When Jerry died, they even put up a little Buddhist-esque shrine. When we used to go there, we referred to the place as Cafe Dead. Somewhere along the line it was noticed that this was a HEX number. I was re-vamping some file format code and needed a couple of magic numbers: one for the persistent object file, and one for classes. I used CAFEDEAD for the object file format, and in grepping for 4 character hex words that fit after "CAFE" (it seemed to be a good theme) I hit on BABE and decided to use it. At that time, it didn't seem terribly important or destined to go anywhere but the trash-can of history. So CAFEBABE became the class file format, and CAFEDEAD was the persistent object format. But the persistent object facility went away, and along with it went the use of CAFEDEAD - it was eventually replaced by RMI.
Since the word babe is pretty synonmous with chick, I doubt you'll find any deep meaning here. When I hear "CafeBabe" I think of a typical Coffee Grrl: nose peirced, minimum one tatoo, hair dyed black, hate the world the government and parents, and is rather attractive in a necro sort of way.
Personally for me, in principle I always enjoyed 0xFA1AFE1, but the high-order nybble being unset always felt a bit displeasing; and, after I accidentally wrote 0xFA1AFEL one time, which is neither the same value nor the same type, realised it might be higher risk than fun :)
juliethefoxcoon | 5 hours ago
This post is mostly just speculation. If you want the actual answer for why CAFEBABE was chosen, james gosling himself actually gave an answer
notgull | 3 hours ago
This is interesting, and a little shocking that CAFE wasn't derived from "Java".
mdaniel | 18 hours ago
OT1H, very cool; OTOH, 48 bit words :-D I presume that's related to BCD being 6bit
lake | 6 hours ago
stay awesome, 1996.
jcc333 | 9 hours ago
Good ole' 0xBEEFBEEF would never steer you wrong
rileylabrecque | 3 hours ago
I see what you did there.
I was always partial to 0xDEADBEEF though
dimonomid | 17 hours ago
Pretty common technique to use such "cool" numbers for similar purposes.
My old Tneo RTOS project still uses 0xFEEDFACE to initialize tasks stack, useful to see unused stack space in debugger.
0xCAFEBABE is indeed very fitting for Java btw, I like that.
baetylboy | 9 hours ago
The magic for the Linux device tree blob file format is d00dfeed which I find pretty funny
danso | 7 hours ago
While we're sharing our favourite 32-bit values, I'm aware of a few indie/hobby projects using
0xACAB1312as their magic number.nathan | an hour ago
Personally for me, in principle I always enjoyed
0xFA1AFE1, but the high-order nybble being unset always felt a bit displeasing; and, after I accidentally wrote0xFA1AFELone time, which is neither the same value nor the same type, realised it might be higher risk than fun :)intelfx | 58 minutes ago
...nor a valid hexadecimal literal
(unless this was C and it duly yielded a long of the value0x00FA1AFE?)