Why are the first four bytes of the Java class file format CAFEBABE? Who named it?
为什么Java类文件格式的前四个字节是CAFEBABE?是谁命名的?
Your views/guesses?
Source: IBM Java Programing Dynamics
来源:IBM Java编程动态
2 个解决方案
#1
74
James Gosling, the father of Java programming language, once explained it as follows:
Java编程语言之父James Gosling曾解释如下:
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:据我所知,我是这个人的罪魁祸首。我完全没有意识到NeXT的连接。少量有趣的HEX词可能是比赛的来源。至于在Java中推导使用CAFEBABE,它有点迂回:
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.
我们曾经去过一个名叫St Michael's Alley的地方吃午饭。根据当地的传说,在深黑的过去,感恩的死者曾经在他们做大之前在那里表演。这是一个非常时髦的地方,绝对是一个感恩的死亡金点。当杰瑞去世时,他们甚至还建了一座佛教圣地。当我们去那里时,我们把这个地方称为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 afterCAFE
(it seemed to be a good theme) I hit onBABE
and decided to use it.沿着这条线的某处,人们注意到这是一个十六进制数字。我正在重新编写一些文件格式代码,需要一些神奇的数字:一个用于持久对象文件,一个用于类。我使用CAFEDEAD作为目标文件格式,并且在CAFE之后插入适合4个字符的十六进制单词(它似乎是一个很好的主题)我点击了BABE并决定使用它。
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, andCAFEDEAD
was the persistent object format. But the persistent object facility went away, and along with it went the use ofCAFEDEAD
- it was eventually replaced by RMI.在那个时候,除了历史的垃圾之外,它似乎并不是非常重要或注定要去任何地方。因此CAFEBABE成为类文件格式,CAFEDEAD是持久对象格式。但持久对象设施消失了,随之而来的是CAFEDEAD的使用 - 它最终被RMI取代。
Source:
- Wikipedia/Class (file format)
- Bill Bumgarner blog entry:
0xCAFEBABE & 0xFEEDFACE
*/类(文件格式)
Bill Bumgarner博客文章:0xCAFEBABE&0xFEEDFACE
Somewhat related links
- Hex words and upside down words
十六进制的单词和颠倒的单词
#2
5
According to : http://en.wikipedia.org/wiki/Class_(file_format)
根据:http://en.wikipedia.org/wiki/Class_(file_format)
Class files are identified by the following 4 byte header (in hexadecimal): CA FE BA BE
. The history of this magic number was explained by James Gosling:
类文件由以下4字节标头(十六进制)标识:CA FE BA BE。 James Gosling解释了这个神奇数字的历史:
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.
我们曾经去过一个名叫St Michael's Alley的地方吃午饭。根据当地的传说,在深黑的过去,感恩的死者曾经在他们做大之前在那里表演。这是一个非常时髦的地方,绝对是一个感恩的死亡金点。当杰瑞去世时,他们甚至还建了一座佛教圣地。当我们去那里时,我们把这个地方称为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 onBABE
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. SoCAFEBABE
became the class file format, andCAFEDEAD
was the persistent object format. But the persistent object facility went away, and along with it went the use ofCAFEDEAD
- it was eventually replaced by RMI.沿着这条线的某处,人们注意到这是一个十六进制数字。我正在重新编写一些文件格式代码,需要一些神奇的数字:一个用于持久对象文件,一个用于类。我使用CAFEDEAD作为目标文件格式,并且在为“CAFE”(它似乎是一个好主题)之后适合4个字符的十六进制单词时,我点击了BABE并决定使用它。在那个时候,除了历史的垃圾之外,它似乎并不是非常重要或注定要去任何地方。因此CAFEBABE成为类文件格式,CAFEDEAD是持久对象格式。但持久对象设施消失了,随之而来的是CAFEDEAD的使用 - 它最终被RMI取代。
Another story: http://radio-weblogs.com/0100490/2003/01/28.html
另一个故事:http://radio-weblogs.com/0100490/2003/01/28.html
#1
74
James Gosling, the father of Java programming language, once explained it as follows:
Java编程语言之父James Gosling曾解释如下:
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:据我所知,我是这个人的罪魁祸首。我完全没有意识到NeXT的连接。少量有趣的HEX词可能是比赛的来源。至于在Java中推导使用CAFEBABE,它有点迂回:
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.
我们曾经去过一个名叫St Michael's Alley的地方吃午饭。根据当地的传说,在深黑的过去,感恩的死者曾经在他们做大之前在那里表演。这是一个非常时髦的地方,绝对是一个感恩的死亡金点。当杰瑞去世时,他们甚至还建了一座佛教圣地。当我们去那里时,我们把这个地方称为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 afterCAFE
(it seemed to be a good theme) I hit onBABE
and decided to use it.沿着这条线的某处,人们注意到这是一个十六进制数字。我正在重新编写一些文件格式代码,需要一些神奇的数字:一个用于持久对象文件,一个用于类。我使用CAFEDEAD作为目标文件格式,并且在CAFE之后插入适合4个字符的十六进制单词(它似乎是一个很好的主题)我点击了BABE并决定使用它。
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, andCAFEDEAD
was the persistent object format. But the persistent object facility went away, and along with it went the use ofCAFEDEAD
- it was eventually replaced by RMI.在那个时候,除了历史的垃圾之外,它似乎并不是非常重要或注定要去任何地方。因此CAFEBABE成为类文件格式,CAFEDEAD是持久对象格式。但持久对象设施消失了,随之而来的是CAFEDEAD的使用 - 它最终被RMI取代。
Source:
- Wikipedia/Class (file format)
- Bill Bumgarner blog entry:
0xCAFEBABE & 0xFEEDFACE
*/类(文件格式)
Bill Bumgarner博客文章:0xCAFEBABE&0xFEEDFACE
Somewhat related links
- Hex words and upside down words
十六进制的单词和颠倒的单词
#2
5
According to : http://en.wikipedia.org/wiki/Class_(file_format)
根据:http://en.wikipedia.org/wiki/Class_(file_format)
Class files are identified by the following 4 byte header (in hexadecimal): CA FE BA BE
. The history of this magic number was explained by James Gosling:
类文件由以下4字节标头(十六进制)标识:CA FE BA BE。 James Gosling解释了这个神奇数字的历史:
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.
我们曾经去过一个名叫St Michael's Alley的地方吃午饭。根据当地的传说,在深黑的过去,感恩的死者曾经在他们做大之前在那里表演。这是一个非常时髦的地方,绝对是一个感恩的死亡金点。当杰瑞去世时,他们甚至还建了一座佛教圣地。当我们去那里时,我们把这个地方称为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 onBABE
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. SoCAFEBABE
became the class file format, andCAFEDEAD
was the persistent object format. But the persistent object facility went away, and along with it went the use ofCAFEDEAD
- it was eventually replaced by RMI.沿着这条线的某处,人们注意到这是一个十六进制数字。我正在重新编写一些文件格式代码,需要一些神奇的数字:一个用于持久对象文件,一个用于类。我使用CAFEDEAD作为目标文件格式,并且在为“CAFE”(它似乎是一个好主题)之后适合4个字符的十六进制单词时,我点击了BABE并决定使用它。在那个时候,除了历史的垃圾之外,它似乎并不是非常重要或注定要去任何地方。因此CAFEBABE成为类文件格式,CAFEDEAD是持久对象格式。但持久对象设施消失了,随之而来的是CAFEDEAD的使用 - 它最终被RMI取代。
Another story: http://radio-weblogs.com/0100490/2003/01/28.html
另一个故事:http://radio-weblogs.com/0100490/2003/01/28.html