---
spec: JVMS
title: "The Java Virtual Machine Specification"
edition: "Java SE 26 Edition"
java_version: 26
chapter: "Chapter 5. Loading, Linking, and Initializing"
section: "5.2"
heading: "5.2. Java Virtual Machine Startup"
parent: "Chapter 5. Loading, Linking, and Initializing"
source: https://docs.oracle.com/javase/specs/jvms/se26/html/jvms-5.html#jvms-5.2
id: "5.2"
url: https://jvm.obfuscated.software/jvms/se26/5.2.html
raw: https://jvm.obfuscated.software/jvms/se26/5.2.md
---

# 5.2. Java Virtual Machine Startup

The Java Virtual Machine starts up by creating an initial class or interface using the bootstrap class loader ([§5.3.1](5.3.1.md)) or a user-defined class loader ([§5.3.2](5.3.2.md)). The Java Virtual Machine then links the initial class or interface, initializes it, creates an instance of it (if necessary), and invokes a `main` method as specified in (JLS §12.1.4). The invocation of this method drives all further execution. Execution of the Java Virtual Machine instructions of the instance initialization method (if needed) and `main` method of the initial class or interface may cause linking (and consequently creation) of additional classes and interfaces, as well as invocation of additional methods.

The initial class or interface is specified in an implementation-dependent manner. For example, the initial class or interface could be provided as a command line argument. Alternatively, the implementation of the Java Virtual Machine could itself provide an initial class that sets up a class loader which in turn loads an application. Other choices of the initial class or interface are possible so long as they are consistent with the specification given in the previous paragraph.

In contrast, the selection and invocation of a `main` method of the initial class or interface proceeds according to the implementation-independent rules given in (JLS §12.1.4).
