Difference between JDK, JRE, and JVM

The minimum environment required for a java program to run is called JRE (Java Runtime Engine). JDK is the minimum environment required for development of Java Applications.

Java Runtime Engine (JRE)

It is an environment that is required for executing a java application. A very popular usage

of JRE is with a browser where it is available as a plugin to allow applet (client side

program) to execute. JRE is composed of following components:

  1. Interpreter: It understand binary java code (e.g.: java.exe).
  2. Tools: They provide various functionality such as security, core services, internationalization, RMI etc. (e.g.: keytool, rmiregistry, javacpl etc)
  3. Library: Java Application Programming Interface (rt.jar, jce.jar, jsse.jar etc.)

JRE cannot be used for development of Java application but it is used for executing them.

Java Development Kit (JDK)

It is an environment that is targeted for developers who desire to develop Java applications.

JDK is nothing but Java Standard Edition which is used for development of desktop, user interface, communication and applet types of applications. JDK is composed of following components:

  1. Compiler: It is used to compile java code to bytecode (e.g. Javac.exe).
  2. Interpreter: It processes bytecode to native code (e.g. java.exe).
  3. Tools: They provide functionality such as RMI, internationalization, core services, security.
  4. Library: Reusable pre-defined Java API (rt.jar, jce.jar, jsse.jar etc.).

JDK is a super set of JRE. JDK has all the components that JRE has plus it has a compiler.

JVM (Java Virtual Machine)

JVM (Java Virtual Machine) is a very important part of both JDK and JRE because it is contained or inbuilt in both. Whatever Java program you run using JRE or JDK goes into JVM and JVM is responsible for executing the java program line by line, hence it is also known as an interpreter.

Java applications are called WORA (Write Once Run Anywhere). This means a programmer can develop Java code on one system and can expect it to run on any other Java-enabled system without any adjustment. This is all possible because of JVM.