A Complete Overview of Java Virtual Machine:
Java Deployment was explained clearly in our last tutorial. Here, we will explore more about JVM.
Java Virtual Machine – JVM is a software implementation of a machine.
While downloading JDK, JVM also comes with that. JRE provides the run-time environment. There are different JVM for a different operating system, thus JVM is dependent on the operating system. But Java is independent of the operating system. Don't forget to take a look at our Entire Java beginner training series.
In this tutorial, we will dive deep and explore more about Java Virtual Machine(JVM) and How it helps in running the java application.
Here is a Video tutorial on JVM:
How JVM Helps in Running Java Application
From the above diagram, we can say that JVM forms a layer between the operating system and Java programs.
Which means, the compiled java program will talk to the JVM and JVM will talk to the operating system. As soon as you install JDK, JVM will also get installed.
Javaprogram –> compiler –> .class files —-> JVM —->bytecode(1’s&0’s)
Java is a platform as well as a language. JVM has to determine the OS and it will convert the .class files into OS understanding instructions.
JVM is a kind of mediator between the compiled class files and the operating system.
In C language, the program is converted into assembly language and the OS gets the instruction from the assembly.
In the case of java, the compiler doesn’t directly talk with the Operating System. Only the JVM will talk to the OS. Also, you can get different JVM for different OS. That is why Java is independent of the operating system.
Java Virtual Machine is an interpreter, which interprets the java class files into the machine code in a way in which the machine code can be understood by the operating system.
It provides the run-time environment to the Java bytecodes.