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

# 5.7. Java Virtual Machine Exit

The Java Virtual Machine exits when some thread invokes the `exit` method of class `Runtime` or class `System`, or the `halt` method of class `Runtime`, and the `exit` or `halt` operation is permitted by the security manager.

In addition, the JNI (Java Native Interface) Specification describes termination of the Java Virtual Machine when the JNI Invocation API is used to load and unload the Java Virtual Machine.
