Execution of Java programs
The development, compilation and execution of Java programs is taken care by JDK which contains 2 main components: Development tools and JRE.
Let us first discuss about development tools. The development tools consist of Java compiler and Java launcher.
Java compiler (javac.exe) - It is the primary Java compiler. The compiler accepts Java source code and produces Java bytecode conforming to the Java Virtual Machine Specification (JVMS).
Java launcher (java.exe) - It helps in launching a Java application during execution.
Next, let us discuss about Java Runtime Environment (JRE).
The Java Runtime Environment (JRE) contains Java Virtual Machine(JVM) and the Java standard library (Java Class Library).
Java Virtual Machine (JVM) - It is the virtual machine that enables the computer to run Java programs.
Java standard library (Java Class Library) - It is a set of dynamically loadable libraries that Java applications can call at run time. Java Platform is not dependent on a specific operating system and hence applications cannot rely on any of the platform-native libraries. So, the Java Platform provides a set of standard class libraries containing functions common to modern operating systems.
By now, you would have understood the components of JDK. Next, you will see how does a Java program get executed by the computer.
The below diagram shows various stages that a Java program goes through during execution.
The Java source code is saved in a file with .java extension. When we compile a Java program (.java file), .class files (byte code) with the same class names present in .java file are generated by the Java compiler (javac). These .class files go through various steps when we run the program as shown in the below diagram.
Comments
Post a Comment