# Generating Java bytecode: Write yourself a compiler, Part V

DevFeed: [Generating Java bytecode: Write yourself a compiler, Part V](<https://devfeed.tech/articles/generating-java-bytecode-write-yourself-a-compiler-part-v-38041.md>)

Original publisher: [Read original article](<https://nurkiewicz.com/2026/09/generating-java-bytecode-write-yourself-a-compiler.html>)

Published: 2026-09-14T22:00:00Z

Content type: tutorial

Language: en

Sources: [Tomasz Nurkiewicz around Java and concurrency](<https://devfeed.tech/sources/tomasz-nurkiewicz-around-java-and-concurrency.md>)

Topics: [Java](<https://devfeed.tech/topics/java.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [Programming](<https://devfeed.tech/topics/programming.md>)

Tags: [bytecode](<https://devfeed.tech/tags/bytecode.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [file](<https://devfeed.tech/tags/file.md>), [go](<https://devfeed.tech/tags/go.md>), [interpreter](<https://devfeed.tech/tags/interpreter.md>), [java](<https://devfeed.tech/tags/java.md>), [jvm](<https://devfeed.tech/tags/jvm.md>), [virtual-machine](<https://devfeed.tech/tags/virtual-machine.md>), [writing-compiler](<https://devfeed.tech/tags/writing-compiler.md>)

## AI overview

This tutorial explains how to extend a toy-language compiler to emit valid JVM bytecode in a .class file that can run on the Java Virtual Machine. It introduces JVM instruction families for pushing integer values and explains how the constant pool stores constants and symbolic references for reuse.

## Source excerpt

Last time we created a virtual machine for our toy language. I think you can agree that designing a language which barely recognizes expressions like 2 + 3w and building a brand-new virtual machine for it seems a bit tedious. So what about keeping our microscopic language for now, but running it on a real, production-ready, battle-proven virtual machine? Like the Java Virtual Machine? Our task for today is to emit JVM bytecode in the form of a valid .class file. That file can then be fed directly to the JVM to run our program.