If you are new to programming language java, you might be wondering what is difference between JVM, JRE and JDK. Often many people are confused with these terms, let’s see what exactly are these.
JDK vs JRE vs JVM
JDK stands for Java Development Kit it is the subset of SDK which stands for Software Development Kit. JDK is what used by developer to write, compile, test, debug and trouble shoot the (code)programs he is creating in java. It is comprised of development tools + JRE.
JDK is required for the developer to write code, compile, test, debug and monitor.
It contains tools to create distributable jar files, profiling and more. It is nothing but a set of tools .
JRE stands for Java Runtime Environment. It’s job is to provide runtime environment and libraries to the program which is getting interpreted by JVM. JRE Contains JVM. Java is platform independent, infact JRE is what making it possible to compile once and execute anywhere. To execute java one should need JRE. If user wants to run java program he should need JRE installed on his machine but JDK is not necessary. JRE is available to download at Java SE downloads .
JVM stands for Java Virtual Machine. It is the critical part, it is part of JRE. If you install JRE, it includes JVM. If you install JDK for development, which includes JRM which includes JVM.
JVM is the interpreter, which executes the java (JVM) bytecode. Java source code is compiled into bytecode by java (javac) compiler. These compiled files typically have .class extension. These .class files can be share across different computers and executed by Java Virtual Machine.
As explained above unlike C/C++, java class (compiled/bytecode) files are not directly executed on processor. JVM takes care of hardware specifics and platform. So, we don’t need to worry about recompiling code again and again for each targeted platform and hardware. Java source code if often compiled into .class files and all of those files and resource are aggregated into one file called jar (Java Archive) to distribute.