Hello viewers, Once again welcome back to Java Jagran. Today I am going to discuss "Difference between JDK, JRE and JVM". So Let's start:
JDK
- JDK is an acronym for Java Development Kit.
- It physically exists.
- It contains JRE + development tools.
JRE
- JRE is an acronym for Java Runtime Environment.
- It is used to provide a runtime environment.
- It is the implementation of JVM.
- It physically exists.
- It contains set of libraries + other files that JVM uses at runtime.
- Implementation of JVMs is also actively released by other companies besides Oracle.
JVM
- JVM (Java Virtual Machine) is an abstract machine. It is a specification that provides a runtime environment in which java bytecode can be executed.
- JVMs are available for many hardware and software platforms. JVM, JRE and JDK are platform dependent because the configuration of each OS differs. But, Java is platform independent.
- The JVM performs following main tasks:
- Loads code
- Verifies code
- Executes code
- Provides runtime environment
As a developer, we write a Java program i.e *.java file. Further, we compile the Java program and the *.class file is generated which is also known as bytecode. Now to execute this bytecode we need a something. But what exactly is that? Java Virtual Machine(JVM) is a virtual machine which runs the Java bytecode/.class file and generates the output.