Home > Java > Javagetting Started > How to run java program

How to run java program

(*-*)浩
Release: 2019-11-14 09:18:21
Original
7061 people have browsed it

How to run java program

Steps to run a Java program:

1. Edit the source code xxx.java (Recommended learning: java course

2. Compile the xxx.java file to generate the bytecode file xxx.class

3. The class loader in the JVM loads the bytecode file

4. The execution engine in the JVM finds the entry method main() and executes the methods

How to run java program

From source code to bytecode:

From the java file we wrote to the java bytecode file compiled by the compiler (that is, the .class file), this process is the java compilation process; platform. Virtual machines on various platforms all use this same program storage format. Furthermore, the jvm runs class bytecode files, as long as they are files in this format. Therefore, in fact, the jvm is not as tightly tied to the java language as I thought before.

Redirect the bytecode file generated by a simple HelloWorld program into a txt file:

javap -v HelloWorld > HelloWorld.class.txt, part of the information is as follows

How to run java programA bytecode file contains the magic number and Class file version, constant pool, access flags and other information. In short, the bytecode file is very simple and powerful. It stores this Various information about the class: fields, methods, parent classes, implemented interfaces, etc.

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

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template