JDK is the Java Development Kit, JRE stands for the Java Runtime Environment while JVM stands for the Java Virtual Machine. As my past experience, I always used to get confused among these. So let’s make sure, how I write will never make us forget any of this again.
So, JVM is the prime abstract machine that gets created, that executes all of the bytecodes generated out of our java code by JDK. The JVM instance has a single mission to run one Java application. Whenever we start our Java application, JVM instance too is born. Lets say, if there are three Java applications you started at the same time, there will be three JVM instances created, each one running inside it’s own JVM.
JVM primarily does the following:
- Class Loader component loads the bytecode generated by JDK compiler
- Verifies it
- Executes it
- Provides the runtime environment to the executing application (JRE)
Assuming JVM to be an abstract class, JRE is just the implementation of JVM. It provides the JVM with the required set of libraries at runtime. JVM being abstract, JRE exists physically.
- Implementation of JVMs (JRE) are also released by other companies besides Sun Micro Systems.
- JRE is the one responsible for the creation of JVM (Java Virtual Machine).
- The JRE has evolved a lot since it was developed by Sun Microsystems Inc. A variety of classes and packages have been added to the core library and APIs have been changed significantly from what it was.
JDK is the aggregate of JRE + development tools.
JDK additionally provides the tools for the development of the Java code and the execution of the same, while JRE providing the needed libraries at runtime. Tools such as appletviewer and the Java Compiler itself is provided by the JDK. There are different versions of JDK, the latest one being the JDK 1.8 update 25.