---
spec: JVMS
title: "The Java Virtual Machine Specification"
edition: "Java SE 26 Edition"
java_version: 26
chapter: "Chapter 3. Compiling for the Java Virtual Machine"
section: "3"
heading: "Chapter 3. Compiling for the Java Virtual Machine"
source: https://docs.oracle.com/javase/specs/jvms/se26/html/jvms-3.html
id: "3"
url: https://jvm.obfuscated.software/jvms/se26/3.html
raw: https://jvm.obfuscated.software/jvms/se26/3.md
---

# Chapter 3. Compiling for the Java Virtual Machine

The Java Virtual Machine machine is designed to support the Java programming language. Oracle's JDK software contains a compiler from source code written in the Java programming language to the instruction set of the Java Virtual Machine, and a run-time system that implements the Java Virtual Machine itself. Understanding how one compiler utilizes the Java Virtual Machine is useful to the prospective compiler writer, as well as to one trying to understand the Java Virtual Machine itself. The numbered sections in this chapter are not normative.

Note that the term "compiler" is sometimes used when referring to a translator from the instruction set of the Java Virtual Machine to the instruction set of a specific CPU. One example of such a translator is a just-in-time (JIT) code generator, which generates platform-specific instructions only after Java Virtual Machine code has been loaded. This chapter does not address issues associated with code generation, only those associated with compiling source code written in the Java programming language to Java Virtual Machine instructions.

**Sections:**

- [3.1. Format of Examples](3.1.md)
- [3.2. Use of Constants, Local Variables, and Control Constructs](3.2.md)
- [3.3. Arithmetic](3.3.md)
- [3.4. Accessing the Run-Time Constant Pool](3.4.md)
- [3.5. More Control Examples](3.5.md)
- [3.6. Receiving Arguments](3.6.md)
- [3.7. Invoking Methods](3.7.md)
- [3.8. Working with Class Instances](3.8.md)
- [3.9. Arrays](3.9.md)
- [3.10. Compiling Switches](3.10.md)
- [3.11. Operations on the Operand Stack](3.11.md)
- [3.12. Throwing and Handling Exceptions](3.12.md)
- [3.13. Compiling finally](3.13.md)
- [3.14. Synchronization](3.14.md)
- [3.15. Annotations](3.15.md)
- [3.16. Modules](3.16.md)
