JVM is a virtual machine that enables computer device to run Java programs and programs written in other languages and compiled to Java bytecode,virtual machine that runs Java class files in a portable way in such a way being a virtual machine means the JVM is an abstraction of an underlying, actual machine such as the server that your program is running on.
Technical definition: The JVM is the specification for a software program that executes code and provides the runtime environment for that code.
Everyday definition: The JVM is how we run our Java programs. We configure the JVM’s settings and then rely on it to manage program resources during execution.
When developers talk about the JVM, they usually mean the process running on a machine, especially a server, that represents and controls resource usage for a Java app. Contrast this to the JVM specification, which describes the requirements for building a program that performs these tasks.
JVM (Java Virtual Machine) has two main primary functions:
Internal Architecture of Java Virtual Machine
This is a subsystem of JVM that is used to load the class files.
Java Stack stores frames. It holds local variables and partial results, and plays a part in method invocation and return.
Stores per-class structures such as the runtime constant pool, field and method data, the code for methods.
It is the runtime data area in which objects are allocated.
PC (program counter) register contains the address of the Java virtual machine instruction currently being executed.
A new frame is created each time a method is invoked. A frame is destroyed when its method invocation completes.
The execution Engine contains:
1) A virtual processor
2) Interpreter: Read bytecode stream then execute the instructions.
3) Just-In-Time(JIT) compiler.