Home Java Javagetting Started How does a java program run?

How does a java program run?

Nov 20, 2019 am 09:21 AM
java program run

How does a java program run?

Program running process:

1. First compile the Java code into bytecode, that is, compile the ".java" type file into ".class" type of file.

The approximate execution flow of this process: Java source code -> Lexical analyzer -> Syntax analyzer -> Semantic analyzer -> Bytecode generator ->Finally generate bytecode , the execution failure of any node will cause the compilation to fail;

2. Place the class file into the Java virtual machine. This virtual machine usually refers to Oracle’s official Hotspot JVM;

3. The Java virtual machine uses the class loader (Class Loader) to load the class file;

4. After the class loading is completed, bytecode verification will be performed. The bytecode verification will be processed by the JVM interpreter. The bytecode is translated into machine code and executed by the operating system, but not all codes are interpreted and executed, and the JVM has optimized this.

For example, take the Hotspot virtual machine, which itself provides JIT (Just In Time), which is what we usually call a dynamic compiler. It can compile hot code into machine code at runtime. This At that time, the bytecode becomes compiled and executed.

Recommended tutorial: java introductory tutorial

The above is the detailed content of How does a java program run?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Square Root in Java Square Root in Java Aug 30, 2024 pm 04:26 PM

Square Root in Java

Perfect Number in Java Perfect Number in Java Aug 30, 2024 pm 04:28 PM

Perfect Number in Java

Random Number Generator in Java Random Number Generator in Java Aug 30, 2024 pm 04:27 PM

Random Number Generator in Java

Armstrong Number in Java Armstrong Number in Java Aug 30, 2024 pm 04:26 PM

Armstrong Number in Java

Weka in Java Weka in Java Aug 30, 2024 pm 04:28 PM

Weka in Java

Smith Number in Java Smith Number in Java Aug 30, 2024 pm 04:28 PM

Smith Number in Java

Java Spring Interview Questions Java Spring Interview Questions Aug 30, 2024 pm 04:29 PM

Java Spring Interview Questions

Break or return from Java 8 stream forEach? Break or return from Java 8 stream forEach? Feb 07, 2025 pm 12:09 PM

Break or return from Java 8 stream forEach?

See all articles