Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the introduction of the Class file in the JVM virtual machine

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Today, I will talk to you about the introduction of Class files in JVM virtual machines. Many people may not know much about it. In order to let everyone know more, Xiaobian summarizes the following contents for everyone. I hope you can gain something according to this article.

I. Introduction

Class file full name is called Java class file, class file path breaks the C or C++ and other languages followed by the tradition, when compiling and linking a C++ program, the resulting executable binary file can only run on the specified hardware platform and operating system, because this binary file contains the machine language for the target processor.

Java programs (class files) are not native executable programs. When running Java programs, first run the JVM (Java Virtual Machine), that is, virtualize a computer on the computer, which exists in computer memory and runs on top of the operating system, and then load Java classes into the JVM to run.

Java class files are binary files that can run on any hardware platform and operating system that supports Java virtual machines, realizing "write once, run everywhere."

II. Definitions

Class file is a set of binary streams based on 8-bit bytes. Each data item is arranged in a compact order in the Class file without adding any separators. According to the Java Virtual Machine specification, the Class file structure stores data using a pseudo-structure similar to the C language structure, which has only two data types: unsigned numbers and tables.

Unsigned numbers belong to the basic data type, u1, u2, u4, u8 to represent 1 byte, 2 bytes, 4 bytes and 8 bytes of unsigned numbers, unsigned numbers can be used to describe numbers, index references, quantity values or according to the UTF-8 encoding of string values.

A table is a conforming data type consisting of multiple unsigned numbers or other tables as data items, all of which customarily end with "_info." A table is used to describe data with a hierarchical composite structure. The entire class file is a table consisting of the data items shown in the table below.

Whether unsigned numbers or tables, when it is necessary to describe multiple data of the same type but with an indefinite number, it is often in the form of a preceding capacity counter plus several consecutive data items. This series of consecutive data of a certain type is called a "set" of a certain type.

It should be emphasized that the structure of Class is not like xml and other description languages, because it does not have any separator symbols, so the data items in the above table, whether it is order or quantity, even the byte order of data storage (Byte Ordering, byte order in Class file is Big-Endian) such details, are strictly limited, which byte represents what meaning, length is how, all are not allowed to change.

III. History of Class File Development

Java technology has been able to maintain a very good backward compatibility, the stability of the Class file structure is not without credit, any programming language can achieve commercial success, it is impossible to upgrade the version, the old version of the compiled product can no longer run this kind of thing. The structure of the Class file, most of them are in the first edition of the Java Virtual Machine Specification (released in 1997, corresponding to the JDK 1.2 era Java virtual machine) has been defined, although the content is ancient, but today, Java development has experienced more than ten major versions, countless small updates, then the definition of the details of the Class file format almost did not appear any change. Although different versions of the Java Virtual Machine Specification have updated the Class file format several times, they basically add new content and expand functions on the basis of the original structure, and do not modify the defined content.

IV. Java virtual machine implementation language independence

After reading the above, do you have any further understanding of what the introduction of Class files in JVM virtual machines is? If you still want to know more knowledge or related content, please pay attention to the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report