In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "what is the process of Java novice from code to run". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1: write code
First of all, what we want the computer to do is expressed through Java and written into a Java file. This process is the process of writing code. The Hello.java file shown in the figure above.
2: compile
After writing the Java code, the machine does not know the Java code we wrote and needs to be compiled into bytecode, and the compiled file is called the class file. The Hello.class file shown in the figure above.
3: class load ClassLoader
The function of class loading is to find and load the classes needed to execute the program.
ClassLoader can enhance the security of code by separating classes on the local machine from network resource classes and checking them when they are called into classes, thus restricting the application of any "Trojan horse".
4: bytecode (byte-code) check
The function is to check the code of the class file to ensure the security of the code.
Java software code is tested several times before it is actually run. JVM enters the code into a bytecode verifier to test the snippet format and do rule checking-- checking for illegal code that forges pointers, violates object access, or attempts to change the object type.
Note-all class files originating from the network have to go through the bytecode checker
The bytecode verifier checks the program code four times, which ensures that the code conforms to the JVM specification and does not destroy the integrity of the system. If the verifier does not return an error message after four times of verification, the following points can be guaranteed:
Class file format that conforms to the JVM specification
No access restriction exception
The code does not cause overflow or underflow of the Operand stack
The parameter types of all operation codes will always be correct.
No illegal data conversion occurs, such as converting integers to object references
Access to the object domain is legal
5: interpretation (Interpreter)
However, the machine cannot recognize the class file, and it needs to be interpreted by the interpreter before the machine can finally understand what we are trying to express.
6: run
* the code is run by the Runtime in the running environment to really do what we want the machine to do.
7: description
As you can see from the above, Java uses a compile phase and a run phase to finally make the machine understand what we want it to do and run according to our requirements.
In these two stages, what we need to complete is the work of the compilation phase, that is to say, we need to express the work we want the machine to do in Java, write it into a Java source file, and then compile the source file to form a class file, and then we can run in the Java runtime environment. The runtime work is provided by the Java platform itself, and we don't need to do much work.
This is the end of the content of "what is the process of a novice Java from code to run". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.