JVM specification question(s)

Started by
3 comments, last by pinacolada 16 years, 2 months ago
I'm interested in using a hex editor (i.e. WinHex) to inspect a Java classfile for the sake of academic learning. Now I understand the so-called "classfile struct" that Java uses includes many different sections, namely: (1) all class files start with the magic number 0xCAFEBABE (2) major and minor JVM versions - 2 bytes (3) constants pool (4) interfaces (5) members ...etc. But what I can't find for the life of me is a clear-cut reference that breaks a class file down in a simple, easy to follow manner. I'm looking for something that reads something like this: (1) The first first four bytes of a Java class file are CAFEBABE: garbage. (2) The next two bytes are the major and minor versions of the specific JVM. (3) The next two bytes tell you the length of the constants pool. (4) The next x-bytes are the constants pool. ... etc. In other words I am having enormous difficulty actually finding material on how to decipher a class file. If you guys have any ideas or suggestions here it would be sweeeet. ply
Advertisement
Chapter 4 of "JVM Specification".

Quote:In other words I am having enormous difficulty actually finding material on how to decipher a class file


Google can be useful for things like this.
Antheus,

I looked up this "google" definition and I do not understand your suggestion. How can a number with 100 zeros after it help me with the Java Virtual Machine?

Thanks for any help here,
ply
googol != google
Quote:Original post by plywood
I'm interested in using a hex editor (i.e. WinHex) to inspect a Java classfile for the sake of academic learning.

Now I understand the so-called "classfile struct" that Java uses includes many different sections, namely:

(1) all class files start with the magic number 0xCAFEBABE
(2) major and minor JVM versions - 2 bytes
(3) constants pool
(4) interfaces
(5) members

...etc.

But what I can't find for the life of me is a clear-cut reference that breaks a class file down in a simple, easy to follow manner. I'm looking for something that reads something like this:

(1) The first first four bytes of a Java class file are CAFEBABE: garbage.
(2) The next two bytes are the major and minor versions of the specific JVM.
(3) The next two bytes tell you the length of the constants pool.
(4) The next x-bytes are the constants pool.
... etc.

In other words I am having enormous difficulty actually finding material on how to decipher a class file. If you guys have any ideas or suggestions here it would be sweeeet.

ply


What is the difference between the first thing and the second thing? If you know how the struct is laid out, then you know the size and position of each field, and (assuming you can read a binary file) you know how to read it.

This topic is closed to new replies.

Advertisement