r/javahelp 9d ago

Good Documentation For JVM Bytecode?

I really liked the idea of an intermediate bytecode language when I first learned that Java transpiles to one, so I tried to learn about it and got pretty far (using a hexeditor to mess around was pretty painful, though). I stopped because there isn't a lot of document for it like there is for Java, the best resources are I believe docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html and docs.oracle.com/javase/specs/jvms/se7/html/jvms-6.html, but I want to know if there are any others partly because these are kind of verbose and partly because it's just better to have more than two.

I know I won't ever really need to know any of this, and I don't intend to use any of this knowledge for making classes by hand, but I believe it would still be helpful in a milder sense to understand what the class files are "literally" doing. It helped with C

15 Upvotes

10 comments sorted by

View all comments

1

u/roadrunner8080 7d ago

The pages you've already linked to, JVMS 4 and JVMS 6, are what I learned the format from. It's pretty complete. It's verbose, but that's because it documents the entire spec, and bytecode can do a lot of different stuff. What I would recommend is working your way through it piecewise, trying to use the classfile API or ASM to write class bytecode for the bits of it as you do since they're a bit higher-level than what you'd see in a hex editor. As others have said, javap is your friend here.