In Java, the terms “compile time” and “run time” refer to different stages of the program development.

Compile time

Compile time is the phase during which the Java source code (.java) is transformed into an intermediate byte code (.class) that the JVM can understand. This includes the following steps:

  1. Java source code The programmer writes Java code in .java files.
  2. JDK compilation The Java Development Kit (JDK) compiler processes the .java files when the programmer runs the javac command or uses an IDE to compile the code. The source code is converted into bytecode, which is stored in .class files.

At the end of the compile time, you have the Java byte code.

Run time

Run time is the phase during which the compiled bytecode is executed by the JVM. This includes the following steps:

  1. Class loading by JVM The JVM loads the Java byte code through its class loader subsystem.
  2. Just-In-Time (JIT) compilation The JVM uses JIT to convert the loaded bytecode into native machine code specific to platform.
  3. 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.
  4. Garbage collection The JVM automatically performs garbage collection to manage memory, it identifies and removes objects that are no longer in use.
  5. Program termination Once program completes its execution, the JVM terminates the program, releasing all the resources and performing all necessary clean up.

During run time, the JVM continuously manages and optimises the execution of the program.


Return to parent page: Java Platform

Web_and_App_DevelopmentProgramming_LanguagesJavaCompile_TimeRun_Time