Java operates through several stages from writing source code to executing the program.
- Java source code
The programmer writes Java code in
.java
file, Java source code is a high-level human readable code. - JDK compilation
The source code is then feed into Java Development Kit (JDK) compiler, the programmer runs
javac
command in the terminal or run the code in their Integrated Development Environment (IDE). The Java source code.java
is converted into bytecode.class
. The bytecode is a low-level, platform independent code that JVM can understand. - Class loading by JVM The Java Virtual Machine (JVM) loads the Java bytecode into its memory through its class loader subsystem. This subsystem is responsible for loading, linking, and initialising the classes. The JVM then verifies the byte code to ensure it adheres to Java’s security and correctness constraints.
- Just-In-Time (JIT) compilation JVM uses JITcompiler to convert bytecode into a specific native machine code specific to underlying hardware or system.
- Execution The JVM executes the native machine code on the host machine. The execution engine of the JVM handles the process, managing memory allocation, garbage collection, and thread management.
- Garbage collection The JVM automatically performs garbage collection to manage memory, it identifies and removes objects that are no longer in use.
- Program termination Once program completes its execution, the JVM terminates the program, releasing all the resources and performing all necessary clean up.
Back to parent page: Java Platform
Web_and_App_Development Programming_Languages Java Java_Working_Process