QA's approach 2 Java - Understanding JVM, JRE, JDK






JVM:

It interprets byte code into machine code depending upon thee underlying OS and hardware combination
It uses the class libraries or packages like util, math, awt, lang, swing, etc.., and other supporting files provide in JRE

The JVM is responsible for the following:

• Loading, verifying, and executing the byte code

• Providing a runtime environment for execution of byte code

• Memory management and garbage collection

jvm consists of classloader, memory area, execution engine


Class Area/Method Area:
This is the region where the Execution class gets loaded in the order they are defined.
Static Variables gets initialized with default values.

Heap Area: 

This is the region of memory where objects are stored & memory is allocated for non-static variables.

Stack Area: 

Order considered for execution of blocks & methods in stack frame as follows:
Static blocks, Static main method, Static User defined methods, Non Static blocks, Non static methods will be allocated with individual memory stacks frames & gets executed one after the other in the above defined order.

The JVM stores local variables and intermediate results of execution of methods in the stack.


JRE

JRE =JVM+Java class libraries/packages+Run time libraries

Its a Run time environment which implements Java virtual machine , and provides all class libraries & other facilities to execute Java program.


Class Loader
Virtual machine instructions are stored in class files. Each class file contains the instructions for a single class or interface.

When executing a Java program, at least three class loaders are involved.

The bootstrap class loader:
loads Java library classes (typically from the JAR file jre/lib/rt.jar). It is a part of the virtual machine.
Run time libraries

The extension class loader:
loads “standard extensions” from the jre/lib/ext directory.
Predefined Java packages like lang, util, math, etc.

The system class loader:
loads the application classes. It locates classes in the directories and JAR files on the class path.
loads business logic class files from the defined class path.

JDK:


Comments

Popular posts from this blog

QA's approach 2 Java - Understanding Static context

Selenium 4 absolute beginners - How to create Batch execution file

Technologies - Log4J - Create Log4j Configuration File - Where ? How ? What ?