In this article:
- Learn common confusion among JVM, JRE and JDK.
- This will help to understand processing of a java class.
A java programmer writes java file. And its gets executed on any environment. Have you ever thought how? Once programmer done with writing java file, his/her job is done. He/She nothing to worry about what all needed to run java program. But hold on this is not possible on simple computer. Then how? Time to explore this.
That computer must have JDK (java development kit) which provides all necessary tools and libraries to write and execute java programs. Inside JDK, there is JVM (java virtual machine) which reads .class files (the converted .java file from compiler). JVM just understand how to read .class files, it takes help from JRE (Java run time enviroment) to execute .class file. Following pictures depicts this–
If you understand set theory, then in that way- JDK is super set of JRE; and JRE is super set of JVM.
One of the most important interview question is why JVM is called virtual? Answer is JDK is a software bundle which contains JVM too. As there is no physical existence of JVM, hence it is virtual.
Go in depth of JVM internals, class loading and garbage collection. This will provide you solid base for writing efficient programs. Providing some links and books which will surely help you. All the very best.
- JVM internals-
- Book on Garbage collection and more
Till then happy reading,