Type Here to Get Search Results !

What is JVM in Java? difference between JDK,JRE,JVM

JVM(Java Virtual Machine)


What is JVM in Java
What is JVM in Java


Introduction


After the see history of java next point to learn in java is what is JVM and how JVM works so in this tutorial we see what is JVM in java what is the main purpose of JVM also we see what is JDK and JRE also we see difference between JDK,JRE,JVM.

 What is JVM(Java Virtual Machine) in Java


In Java there is important point is the what is JVM.


 Long form of JVM is Java Virtual Machine JVM is used to execute the java application for that required virtual machine is JVM and JVM is responsible to run the program line by line JVM is integral part of java.


It is provide a runtime environment to run the java code. Basically JVM convert the bytecode into the machine language in JVM program file is default save in drive JVM is a part of JRE(java runtime environment).


JVM (Java Virtual Machine) is perform like it can load the code, also it can verified that code, it also responsible to execute the code and also it provide runtime environment.


How JVM is works in java/How java code executed


In Java JVM play and important role where what we write a code java present compiler where compiler take java code and after that complier compiles java bytecode.


Now we run the Java code then JVM (Java Virtual Machine) is executing the java application or it run the program line by line.


Now we see JVM Architecture

JVM (Java Virtual Machine) Architecture


After understanding the JVM We see the internal architecture of JVM how its actual work what are the different parts are presents.


Java Runtime System
Java Runtime System



JVM (Java Virtual Machine)contains 

✅1.Class loader


✅2. JVM memory area contains

  
a) Class area


b) Heap memory


c) Stack memory


d) PC register


e) Native method stack


✅3.Execution Engine
 

✅4.Native Method interface


✅ 5. Java Native Method libraries

1.Class loader

Class loader is used in JVM to load class files and class loader is subsystem of JVM in class loader first when we run program it loaded by the class loader first.

class loader perform three functions

1.Loading

2.Linking

3.Initializing

Also built-in class loader in java is Bootstrap class loader, Extension class loader, System class loader this are the internal class loaders which is provided by java.

2. JVM memory area 


a) Class area


Here JVM memory area contains class area its also know as Method area its main purpose is it store the class structures like runtime pool, metadata, code etc.


b)Heap memory

Heap memory is common memory and it shared between the multiple threads. all the objects and there instance, variables, arrays are stored in heap memory it is an runtime data area.


c) Stack memory

In stack memory store a local variables and also here each thread has its own JVM stack here at each time of thread is created that time JVM stack created.

d) PC registers


PC stands for Program Counter and PC register contains the address of JVM (Java Virtual Machine) instruction which is currently being executing also the most important things is that in java each thread has its own/separate PC (Program counter) register.

e) Native method stack


Native stack method is an another stack where it store all the native methods which is used in  the applications native method stack is depend upon the native libraries.

3.Execution Engine 


Execution engine it used to execution purpose but it never allow/carries to any information about the tested product it is type of software and used to testing. execution engine contains JIT compiler, Interpreter , virtual processor.

4.Native Method interface


Native Method interface as per name it is an interface of program framework which provides the interface to communication. Native Method interface also we called Java native interface(JNI).


5. Java Native Method libraries


 Java Native Method libraries contains the libraries.


What is JDK (Java Development Kit)?


JDK stands for (Java Development Kit) it is and development kit contains the software development kit it development kit contains the all important tools need for developing, compiling  and run the java application.


JDK contains the JDK and development tools and at developer side JDK is required to write and debug the java code. It is important to install the JDK on developer machine.


What is JRE (Java Runtime Environment)?


JRE stands for (Java Runtime Environment) is used to run the java application consist of JVM(Java virtual machine) and libraries. 


JRE provides the necessary runtime environment to run the java application. 


JRE is the part of JDK on client side it is important to install the JRE.



Difference Between JDK,JRE,JVM


JDK  Java Development Kit


1.JDK is used to write the code and debug the code.


2.JDK is used by developers.


JRE Java Runtime Environment


1.JRE is used/required to run the java application


2.JRE is used by client side.


3.JRE is the part of JDK.


JVM  Java Virtual Machine


1.JVM is used/required to execute the bytecodes/java application.


2.JVM is the part of JRE.


How actual code is compile and execute

In JVM to actual compile the code and execute the code we need the different process as following they are


1.Edit


Here editor is used to the write the code/program.

2.Compiler


Which we type the code compiler is convert this high level language program into native machine code.
 

3.Link


As per name given linker is used to link the different programs.


4.Loder


Loader is used to load the code in storage devices and this is done automatically at the time of code execution.


5.Then execute code


Actual code execution is done by OS and processors.


Top Post Ad

Bottom Post Ad