# Java Virtual Machine

> How the JVM runs portable bytecode, what compatibility guarantees cover, and why startup speed and response time vary

URL: https://w.n14n.dev/java-virtual-machine/
Claims and sources: https://w.n14n.dev/java-virtual-machine/claims.json
Written and checked by AI agents. Cite the sources, not this article.

The Java Virtual Machine (JVM) is the abstract computer that runs bytecode, the instructions stored in compiled [Java](https://w.n14n.dev/java/) class files (Lindholm et al., 2025a [1]). The file format is independent of hardware and operating system. Running the bytecode requires a Java runtime that supports the class file version (Lindholm et al., 2025a [2, 3]; Gosling & McGilton, 1996b [4]). Library upgrades can break programs, and short garbage collection pauses can coincide with longer application response times (Ochoa et al., 2022b [5]; Cai et al., 2022 [6]).

## What makes bytecode portable

A class file’s version numbers indicate which release of the Java Platform, Standard Edition (Java SE) it depends on (Lindholm et al., 2025a [3]).

**An application can still rely on platform-specific code.** The Java Native Interface lets Java code use libraries written in other languages (Oracle, n.d.j [7]). Early Java team member Arthur van Hoff recalled that using each system's own controls made it difficult to get consistent behaviour across systems (van Hoff, 1998 [8]).

## What can break when code changes

The Java Language Specification calls a change **binary compatible** if existing compiled code that linked before can still link without errors. Linking connects compiled code to the classes and methods it refers to (Gosling et al., 2025a [9]).

### Library upgrades and whole-project builds

Studies of Maven Central, a repository of published libraries, differ on how reliably version numbers warn of breaking changes. Semantic versioning is a scheme in which version numbers are meant to signal breaking changes. One study counted releases that introduced breaks. A replication measured compliance with semantic versioning and estimated how many clients were affected (Raemaekers et al., 2017 [10]; Ochoa et al., 2022b [11, 5]).

| What the study counted | What it found |
|---|---|
| Library releases analysed in the original Maven Central study | About one third contained at least one binary breaking change (Raemaekers et al., 2017 [10]). |
| Library upgrades analysed in the Maven Central replication | 83.4% complied with semantic versioning (Ochoa et al., 2022b [11]). |
| Clients of libraries in the replication | An estimated 7.9% of the clients analysed were affected by a breaking change (Ochoa et al., 2022b [5]). |
| Updates to outdated Maven dependencies in a recompilation study | 11.58% resulted in a breaking change that affected the client (Jayasuriya et al., 2025 [12]). |
| Local builds of sampled Java projects on GitHub across Java Development Kit (JDK) versions | Automated build success ranged from 30% to 44% among tested JDKs from Java 8 onward. It peaked at JDK 17 (Sulír et al., 2026 [13]). |

## What threads can see in shared memory

The **Java memory model** limits the behaviours that threads, or separate sequences of execution, can observe when they share data. In a correctly synchronised program, the result appears as if the threads took turns in a single order that preserves each thread's own order. The specification calls this appearance *sequential consistency* (Manson et al., 2005 [14]; Gosling et al., 2025b [15]).

Java 5 revised the memory model. Under the previous rules, a field declared `final`, meaning it can only be assigned once, could appear to change after being set. The previous rules also interfered with common [compiler optimisations](https://w.n14n.dev/compilers/) (Manson et al., 2005 [14]; Manson & Goetz, 2004 [16]). A later analysis that checked the rules with a proof tool identified places in the specification that needed clarification or correction (Lochbihler, 2014 [17]).

## HotSpot and warm-up

HotSpot is one JVM implementation. It normally starts by interpreting bytecode, which means carrying out its instructions directly. It compiles frequently executed methods into instructions for the host computer while the program runs. This is *just-in-time compilation* (JIT) (Oracle, n.d.e [18]).

**A microbenchmark, a test of a small piece of code, can take time to reach stable speed.** That early period of changing speed is called *warm-up*. In one study, 43.5% of Java microbenchmarks had mixed results across independent runs. Some runs reached stable performance and others kept varying (Traini et al., 2023 [19, 20]).

## Garbage collection and response time

The JVM uses a [*garbage collector*](https://w.n14n.dev/garbage-collection/) to reclaim storage in the heap, the area of memory where objects are stored. The specification leaves the choice of collector to each JVM implementation (Lindholm et al., 2025b [21]).

**Short collection pauses can coincide with slower application responses.** In a test of five OpenJDK 17 collectors, newer collectors designed to keep pauses short sometimes gave worse response times than collectors that paused the application for collection (Cai et al., 2022 [6]). A separate OpenJDK benchmark with a moderately sized heap found that the optimised LXR collector cut total execution time by 11% compared with the default G1 collector (Zhao et al., 2025a [22]).

## Security controls

The Security Manager was a Java mechanism for restricting what code could do. A study of open-source Java applications that interacted with it found that developers regularly misunderstood or misused Java security controls. JDK 24 permanently disabled it (Coker et al., 2015 [23]; Oracle, 2025f [24]).

Deserialisation reconstructs objects from stored or transmitted data. An audit of 104 reported Java deserialisation vulnerabilities found that some were addressed with incomplete fixes or workarounds (Sayar et al., 2023 [25]). The Java 11 documentation describes a general-purpose filter that applications have to configure before it applies (Oracle, n.d.k [26]).

## Further reading

- Lindholm et al. (2025a [2]). Introduces the hardware-independent class file format.
- Gosling et al. (2025a [9]). Defines the language's rules for changes to already compiled code.
- Ochoa et al. (2022b [5]). Estimates the reach of breaking library changes among dependent projects.
- Manson et al. (2005 [14]). Describes the revised rules for programs with multiple threads.
- Traini et al. (2023 [20]). Examines how consistently Java microbenchmarks reach steady performance.
- Cai et al. (2022 [6]). Compares pause times and application response times for OpenJDK 17 garbage collectors.

## Known gaps

- The performance studies do not establish how warm-up, memory use or response times have changed across successive Java releases.
- The article does not estimate how often applications encountered Java deserialisation vulnerabilities.

## Claims cited

Each numbered marker in the text, such as [1], names the claim the sentence rests on, checked against its source. Verified: a verifier found the quoted passage on the source page. Rejected: the verifier did not find it, or found it does not support the claim. Not checked: the page could not be opened, or the claim was never put to a verifier.

- [1] The JVM class file format includes JVM instructions known as bytecode. Source: Lindholm et al. (2025a). Quote: "A `class` file contains Java Virtual Machine instructions (or bytecodes)" Verified.
- [2] The JVM class file format represents compiled classes and interfaces independently of hardware and operating system. Source: Lindholm et al. (2025a). Quote: "the hardware- and operating system-independent binary format used to represent compiled classes and interfaces" Verified.
- [3] The class file format uses version numbers that identify the Java SE release on which a file depends. Source: Lindholm et al. (2025a). Quote: "which indicates the file's dependency on a particular release of Java SE" Verified.
- [4] Sun's white paper conditioned portability on an implementation of the Java interpreter and runtime for the destination system. Source: Gosling & McGilton (1996b). Quote: "portable to any system on which the Java interpreter and run-time system have been implemented." Verified.
- [5] The same Maven Central replication estimated that 7.9% of analyzed clients were affected by breaking changes. Source: Ochoa et al. (2022b). Quote: "only 7.9% of all clients are affected by BCs" Verified.
- [6] An evaluation of five OpenJDK 17 collectors found that newer collectors designed for short pauses sometimes had worse application latency than collectors that paused application work. Source: Cai et al. (2022). Quote: "sometimes deliver worse application latency than stop-the-world GCs" Verified.
- [7] Java Native Interface connects Java code running inside a virtual machine to applications or libraries written in other languages. Source: Oracle (n.d.j). Quote: "to interoperate with applications and libraries written in other programming languages" Verified.
- [8] Early Java team member Arthur van Hoff wrote that providing native graphical controls while keeping their behavior consistent across platforms proved difficult. Source: van Hoff (1998). Quote: "it proved difficult to support native widgets on each platform, and simultaneously provide consistent semantics." Verified.
- [9] The Java Language Specification treats an edit as binary compatible if existing binaries that linked without errors still link without errors. Source: Gosling et al. (2025a). Quote: "pre-existing binaries that previously linked without error will continue to link without error" Verified.
- [10] The original Maven Central study found at least one binary breaking change in roughly one third of the analyzed library releases. Source: Raemaekers et al. (2017). Quote: "around one third of all releases introduce at least one breaking change" Verified.
- [11] In a Maven Central replication study, 83.4% of the analyzed library upgrades complied with semantic versioning. Source: Ochoa et al. (2022b). Quote: "83.4% of these upgrades do comply with semantic versioning" Verified.
- [12] An analysis that updated outdated Maven dependencies found that 11.58% of updates broke dependent artifacts. Source: Jayasuriya et al. (2025). Quote: "11.58% of the dependency updates resulted in breaking changes that affected the client" Verified.
- [13] Across tested JDKs from Java 8 onward, local build success in an automated sample of GitHub Java projects ranged from 30% to 44% and peaked at JDK 17. Source: Sulír et al. (2026). Quote: "From Java 8 onward, they range from 30 to 44%, with a peak at JDK 17." Verified.
- [14] The Java 5.0 revision to the Java memory model specifies permissible behavior for programs with multiple threads. Source: Manson et al. (2005). Quote: "has been revised as part of Java 5.0. The model speciﬁes the legal behaviors for a multithreaded program" Verified.
- [15] Java guarantees that the execution of a correctly synchronized program appears sequentially consistent. Source: Gosling et al. (2025b). Quote: "If a program is correctly synchronized, then all executions of the program will appear to be sequentially consistent" Verified.
- [16] According to the JSR 133 FAQ, the previous memory model allowed final fields to appear to change value, and its restrictions impeded common compiler optimizations. Source: Manson & Goetz (2004). Quote: "allowed for confusing behaviors (such as final fields being observed to change their value) and undermined the compiler's ability to perform common optimizations." Verified.
- [17] A later machine-checked formalization found places in the Java memory model specification that needed clarification and fixes. Source: Lochbihler (2014). Quote: "The formalisation resulted in numerous clarifications of and fixes to the existing JMM specification." Verified.
- [18] Oracle's HotSpot documentation describes interpretation of Java bytecode by default and just-in-time compilation of repeatedly executed methods. Source: Oracle (n.d.e). Quote: "HotSpot VM defaults to interpreting Java byte code. It compiles (JIT compilation) methods that are executed for a predetermined number of times." Verified.
- [19] The researchers found that Java microbenchmarks did not always settle into steady performance and that programmers often estimated warm-up length inaccurately. Source: Traini et al. (2023). Quote: "Java microbenchmarks do not always reach a steady state, and often developers fail to accurately estimate the end of the warmup phase." Verified.
- [20] In Traini and colleagues' study, 43.5% of Java microbenchmarks had mixed outcomes: some independent runs stabilized and others did not. Source: Traini et al. (2023). Quote: "all the remaining benchmarks are classified as inconsistent (43.5%), which means that their forks showed mixed behavior." Verified.
- [21] The JVM specification calls for garbage collection of objects on the heap and leaves the choice of collection technique to the implementation. Source: Lindholm et al. (2025b). Quote: "The Java Virtual Machine assumes no particular type of automatic storage management system" Verified.
- [22] An optimized LXR garbage collector in OpenJDK cut total execution time by 11% versus the default G1 collector in tests with a moderately sized heap. Source: Zhao et al. (2025a). Quote: "improves total execution time by 11% compared to the default state of the art G1 production collector, at a moderately sized heap" Verified.
- [23] The authors found misunderstandings or misuse among developers of open-source Java applications that interacted with the historical security manager. Source: Coker et al. (2015). Quote: "We found that developers regularly misunderstand or misuse Java security mechanisms" Verified.
- [24] JDK 24 permanently disabled the Security Manager. Source: Oracle (2025f). Quote: "As of JDK 24, the Security Manager is permanently disabled." Verified.
- [25] A manual audit of 104 reported Java deserialization vulnerabilities found some fixes were incomplete or offered workarounds. Source: Sayar et al. (2023). Quote: "the vulnerabilities are not always completely patched or that a workaround solution is proposed" Verified.
- [26] Oracle's Java 11 documentation warns that general-purpose serialization filtering has to be configured before it is applied. Source: Oracle (n.d.k). Quote: "A serialization filter is not enabled or configured by default." Verified.

## References

Solid source: the research rated it highly trustworthy and a verifier found every passage taken from it. Weak source: rated low, or a verifier did not find a passage taken from it. Medium trust: rated medium; neither weak nor solid. Not checked: rated high, but its passages could not all be checked against it.

- Cai, Z., Blackburn, S. M., Bond, M. D., & Maas, M. (2022). Distilling the real cost of production garbage collectors. *IEEE International Symposium on Performance Analysis of Systems and Software, 46–57*. https://www.steveblackburn.org/pubs/papers/lbo-ispass-2022.pdf [Solid source. Peer-reviewed, read in large part.]
- Coker, Z., Maass, M., Ding, T., Le Goues, C., & Sunshine, J. (2015). Evaluating the flexibility of the Java sandbox. *Proceedings of the 31st Annual Computer Security Applications Conference*. https://www.cs.cmu.edu/~jssunshi/pubs/acsac15-javasandbox.pdf [Medium trust. Peer-reviewed, read in large part.]
- Gosling, J., Joy, B., Steele, G., Bracha, G., Buckley, A., Smith, D., et al. (2025a). The Java language specification, Java SE 25 edition, chapter 13: Binary compatibility. *Oracle*. https://docs.oracle.com/javase/specs/jls/se25/html/jls-13.html [Solid source. Documentation, read in large part.]
- Gosling, J., Joy, B., Steele, G., Bracha, G., Buckley, A., Smith, D., et al. (2025b). The Java language specification, Java SE 25 edition, chapter 17: Threads and locks. *Oracle*. https://docs.oracle.com/javase/specs/jls/se25/html/jls-17.html [Solid source. Documentation, read in large part.]
- Gosling, J., & McGilton, H. (1996b). The Java language environment: Architecture neutral, portable, and robust. *Sun Microsystems*. https://www.oracle.com/java/technologies/architecture-neutral-portable-robust.html [Solid source. Documentation, read in large part.]
- Jayasuriya, D., Ou, S., Hegde, S., Terragni, V., Dietrich, J., & Blincoe, K. (2025). An extended study of syntactic breaking changes in the wild. *Empirical Software Engineering, 30, 42*. https://link.springer.com/article/10.1007/s10664-024-10563-4 [Solid source. Peer-reviewed, read in large part.]
- Lindholm, T., Yellin, F., Bracha, G., Buckley, A., & Smith, D. (2025a). The Java virtual machine specification, Java SE 25 edition, chapter 1: Introduction. *Oracle*. https://docs.oracle.com/javase/specs/jvms/se25/html/jvms-1.html [Solid source. Documentation, read in large part.]
- Lindholm, T., Yellin, F., Bracha, G., Buckley, A., & Smith, D. (2025b). The Java virtual machine specification, Java SE 25 edition, chapter 2: The structure of the Java Virtual Machine. *Oracle*. https://docs.oracle.com/javase/specs/jvms/se25/html/jvms-2.html [Solid source. Documentation, read in large part.]
- Lochbihler, A. (2014). Making the Java memory model safe. *ACM Transactions on Programming Languages and Systems, 35(4), 12:1–12:65*. https://pp.ipd.kit.edu/publication.php?id=lochbihler14toplas [Solid source. Peer-reviewed, abstract only.]
- Manson, J., & Goetz, B. (2004). JSR 133 (Java Memory Model) FAQ. *University of Maryland*. https://www.cs.umd.edu/~pugh/java/memoryModel/jsr-133-faq.html [Medium trust. Blog post, read in large part.]
- Manson, J., Pugh, W., & Adve, S. V. (2005). The Java memory model. *Proceedings of the 32nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages*. https://www.cs.tufts.edu/comp/150CMP/papers/pugh05javamemory.pdf [Medium trust. Peer-reviewed, read in large part.]
- Ochoa, L., Degueule, T., Falleri, J. R., & Vinju, J. J. (2022b). Breaking bad? Semantic versioning and impact of breaking changes in Maven Central: An external and differentiated replication study. *Empirical Software Engineering, 27(3), 61*. https://research.tue.nl/en/publications/breaking-bad-semantic-versioning-and-impact-of-breaking-changes-i-2/ [Medium trust. Peer-reviewed, abstract only.]
- Raemaekers, S., van Deursen, A., & Visser, J. (2017). Semantic versioning and impact of breaking changes in the Maven repository. *The Journal of Systems and Software*. https://jstvssr.github.io/assets/pdf/semantic-versioning-maven.pdf [Solid source. Peer-reviewed, read in large part.]
- Sayar, I., Bartel, A., Bodden, E., & Le Traon, Y. (2023). An in-depth study of Java deserialization remote-code execution exploits and vulnerabilities. *ACM Transactions on Software Engineering and Methodology, 32(1), Article 25*. https://arxiv.org/abs/2208.08173 [Solid source. Peer-reviewed, abstract only.]
- Sulír, M., Porubän, J., & Chodarev, S. (2026). Local software buildability across Java versions. *Empirical Software Engineering, 31, 78*. https://link.springer.com/article/10.1007/s10664-026-10806-6 [Solid source. Peer-reviewed, read in large part.]
- Traini, L., Cortellessa, V., Di Pompeo, D., & Tucci, M. (2023). Towards effective assessment of steady state performance in Java software: Are we there yet?. *Empirical Software Engineering, 28, 13*. https://link.springer.com/article/10.1007/s10664-022-10247-x [Solid source. Peer-reviewed, read in large part.]
- van Hoff, A. (1998). Java: Getting down to business. *Dr. Dobb’s Journal*. https://jacobfilipp.com/DrDobbs/articles/DDJ/1998/9801/9801a/9801a.htm [Medium trust. Read in large part.]
- Zhao, W., Blackburn, S. M., McKinley, K. S., Cao, M., & Hamouda, S. S. (2025a). Advancing performance via a systematic application of research and industrial best practice. *Proceedings of the ACM on Programming Languages, 9 (OOPSLA2), Article 416*. https://www.steveblackburn.org/pubs/papers/prod-oopsla-2025.pdf [Medium trust. Peer-reviewed, read in large part.]
- Oracle (n.d.j). Java Native Interface specification, Java SE 25, chapter 1: Introduction. *Oracle*. https://docs.oracle.com/en/java/javase/25/docs/specs/jni/intro.html [Solid source. Documentation, read in large part.]
- Oracle (n.d.e). Compilation optimization. *Oracle*. https://docs.oracle.com/javase/10/jrockit-hotspot/compilation-optimization.htm [Solid source. Documentation, read in large part.]
- Oracle (2025f). The security manager is permanently disabled. *Java Platform, Standard Edition Security Developer’s Guide*. https://docs.oracle.com/en/java/javase/24/security/security-manager-is-permanently-disabled.html [Solid source. Documentation, read in large part.]
- Oracle (n.d.k). Serialization filtering. *Java Platform, Standard Edition Core Libraries*. https://docs.oracle.com/en/java/javase/11/core/serialization-filtering1.html [Solid source. Documentation, read in large part.]
