Imagine a bacon-wrapped Ferrari. Still not better than our free technical reports.

Mastering Java Bytecode at the Core of the JVM

Why Should I Know About Java Bytecode?

Whether you are a Java developer or architect, CxO or simply the user of a modern smart phone, Java bytecode is in your face, quietly supporting the foundation of the Java Virtual Machine (JVM).

Directors, executives and non-technical folks can take a breather here: All they need to know is that while their development teams are building and preparing to deploy the next amazing version of their software, Java bytecode is silently pumping through the JVM platform.

Put simply, Java bytecode is the intermediate representation of Java code (i.e. class files) and it is executed inside the JVM – so why should you care about it? Well, because you cannot run your entire development ecosystem without Java bytecode telling it all what to do, especially how to treat and define the code that Java developers are writing.

From a technical POV, Java bytecode is the code set used by the Java Virtual Machine that is JIT-compiled into native code at runtime. Without Java bytecode behind the scenes, the JVM would not be able to compile and mirror the non-bytecode Java code developers write to add new features, fix bugs and produce beautiful apps.

What if you no longer had to redeploy your Java code to see changes? The choice is yours. In just a few clicks you can Say Goodbye to Java Redeploys forever.

Many IT professionals might not have had the time to goof around with assembler or machine code, so Java bytecode can seem like an obscure piece of low-level magic. But, as you know, sometimes things go really wrong and understanding what is happening at the very foundation of the JVM may be what stands between you and solving the problem at hand.

In this RebelLabs report you will learn how to read and write JVM bytecode directly, so as to better understand how the runtime works, and be able to disassemble key libraries that you depend on.

In addition to getting the skinny on Java bytecode, we interviewed bytecode specialists Cédric Champeau and Jochen Theodorou working on the Groovy ecosystem at SpringSource, and tech lead Andrey Breslav working on Kotlin, a newcomer to the JVM language party, from JetBrains.

We will cover the following topics:

  • How to obtain the bytecode listings
  • How to read the bytecode
  • How the language constructs are mirrored by the compiler: local variables, method calls, conditional logic
  • Introduction to ASM
  • How bytecode works in other JVM languages like Groovy and Kotlin

So, get ready for your journey to the center of the JVM, and don’t forget your compiler ;-)

Take the Full PDF Home with You

  • Maik

    What’s with the complicated PDF download stuff? Couldn’t this be a regular blog article?

  • Mark

    I filled the form three or four times already and never got the link. What’s the problem with this PDF?

  • Oliver

    If you have signed up for other Rebel Labs reports and then unsubscribed, our system will not send anything to you by default, even if you sign up. Just a way of protecting our readers from unwanted communication. If you feel like this happened and you want to sign up again, email us at! :-)

  • R Jiyani

    Its very very nice article , Impressed ! I was actually searching for how java decompiler works and reached here :) , Also tried JRebel with Eclipse+Tomcat (free one !) superb !
    Currently I am not owner of any company but when I will definitely use such plugins , great work done !

  • Just a minor thing. ASM’s compute frames implies compute maxs. It’s not necessary to apply both options.

  • junmin liu

    I have a question here, see this gist,

    i have a static method defined as:
    public static RandomListNode copyHelper(RandomListNode head, Map hm)

    Or defined as

    public static RandomListNode copyHelper(RandomListNode head, HashMap hm)

    The first will lead to invokeInterface, the second lead to invokeVirtual. The first doesn’t cause StackOverflow and second will for the same test data.

  • arhan

    In case of the interface, do you still pass a HashMap implementation as a parameter? I doubt that the error is related to bytecode instruction, but maybe it is related to Map implementation that you pass in as a parameter?

  • junmin liu

    Yes, in both cases I passed a hashMap when I called the recursion function like this: copyHelper(node, new HashMap());

    I use javap to look at the generated bytecode, the only difference is The first uses invokeInterface, the second uses invokeVirtual, will JIT inline the invokeVirtual call to make the stack frame size bigger so the recursion caused StackOverflow?

  • junmin liu

    Last night I turned on the -XX:+PrintInlining option, still have no clue.