Compilation and Execution Process,

 

Java program Compilation and Execution Process,

Java design defines the components that are essential for the processing, compilation and execution of a code written in Java programming.
Various components that are essential for the compilation and execution of Java program:

  • Source File.
  • Class File.
  • JVM
  • Application Programming Interface.


Java Architecture Cycle:


Java program Compilation and Execution Process,


Source File:

In order to write a Java program or an application, You need to write a certain code. A Java application contains the source code that allows an application to provide its desired functionalities. This source code is saved in a source file with the extension.java.

Class File:

Once created a .Java file is compiled to create a .class file. A class file includes the bytecode that is produced by the compiler. Further, This class file can be executed by any machine that supports the Java Runtime Environment(JRE).

JVM(Java Virtual Machine):

The JVM is an application that is subject for executing the java programs on a computer. It resides in the Random Access Memory(RAM) and is specific for every platform, Such as Windows and Mac. The bytecode generated during the compilation of a program is the machine language of the JVM. JVM is responsible for executing the bytecode and generating the machine-specific code for the machine on which the java program to be executed.

Major components of JVM are:

  • ClassLoader.
  • Execution engine and Just in time(JIT) compiler.
  • Bytecode verifier.

ClassLoader:

The ClassLoader loads the files required by the program that needs to be executed. The classes are loaded dynamically when required by the running program.

Execution engine and Just in time(JIT) compiler:

The  Java execution engine acts as an interpreter that interprets the bytecode one line after another and executes it. The line by line interpretation is a time-consuming task and reduces the performance of a program. To enhance the performance, The JIT compiler has been introduced in the JVM. The JIT compiler compiles the bytecode into machine-executable code, as and when needed, which optimizes the performance of a java program.

Bytecode Verifier;

Before being executed by the JVM, The bytecode is verified by using the bytecode verifier. The bytecode verifier ensures that the bytecode is executed safely and does not pose any security threat to the machine.

API(Application Program Interface):

The Java API is a collection of software components, such as classes and interfaces, and methods, which provides various capabilities, such as GUI, Date, Time and calendar. The related classes and interface of the Java API are grouped into packages

Post a Comment

0 Comments