Sign in to follow this  

JVM specification question(s)

This topic is 3600 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 3600 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this