Java operates through several stages from writing source code to executing the program.

  1. Java source code The programmer writes Java code in .java file, Java source code is a high-level human readable code.
  2. 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.
  3. 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.
  4. Just-In-Time (JIT) compilation JVM uses JITcompiler to convert bytecode into a specific native machine code specific to underlying hardware or system.
  5. 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.
  6. Garbage collection The JVM automatically performs garbage collection to manage memory, it identifies and removes objects that are no longer in use.
  7. 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_DevelopmentProgramming_LanguagesJavaJava_Working_Process