Java Development Kit :-
JDK stands for “Java Development Kit”, The Java Development Kit (JDK) is a software development environment used for developing Java applications and applets. It includes the Java Runtime Environment (JRE), an interpreter/loader (Java), a compiler (javac), an archiver (jar), a documentation generator (Javadoc) and other tools needed in Java development.

Java Runtime Environment :-
JRE stands for “Java Runtime Environment” and may also be written as “Java RTE.”The Java Runtime Environment provides the minimum requirements for executing a Java application; it consists of the Java Virtual Machine (JVM), core classes, and supporting files.
The Java Runtime Environment is a set of software tools which are used for developing Java applications. It is used to provide the runtime environment. It is the implementation of JVM. It contains a set of libraries + other files that JVM uses at runtime.

Java Virtual Machine :-
JVM stands for “Java Virtual Machine”. It is called virtual machine as it exists virtually not physically. It is a specification that provides a runtime environment in which Java bytecode can be executed. It can also run those programs which are written in other languages and compiled to Java bytecode. It is a Runtime Instance Whenever you write java command on the command prompt to run the java class, an instance of JVM is created.
JVMs are available for many hardware and software platforms. JVM, JRE, and JDK are platform dependent because the configuration of each OS is different from each other. However, Java is platform independent.

Difference between JDK, JRE and JVM
The below chart shows the different features of each of the Java technologies.

chart
*Image Courtesy: Oracle Corporation

JRE = JVM + Required Library to run Application.
JDK = JRE + Required Library to develop Java Application.

Java Development Kit (JDK) is Kit which provides the environment to develop and execute(run) the Java program. JDK is a kit(or package) which includes two things
    1. Development Tools(to provide an environment to develop your java programs)
    2. JRE (to execute your java program).
Note : JDK is only used by Java Developers.

Java Runtime Environment (JRE) is an installation package which provides environment to only run(not develop) the java program(or application)onto your machine. JRE is only used by them who only wants to run the Java Programs i.e. end users of your system.

Java Virtual machine(JVM) 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 interpreter.

How does JRE and JDK Works?
JRE consists of the following components:
  • Deployment technologies, including deployment, Java Web Start and Java Plug-in.
  • User interface toolkits, including Abstract Window Toolkit (AWT), Swing, Java 2D, Accessibility, Image I/O, Print Service, Sound, drag and drop (DnD) and input methods.
  • Integration libraries, including Interface Definition Language (IDL), Java Database Connectivity (JDBC), Java Naming and Directory Interface (JNDI), Remote Method Invocation (RMI), Remote Method Invocation Over Internet Inter-Orb Protocol (RMI-IIOP) and scripting.
  • Other base libraries, including international support, input/output (I/O), extension mechanism, Beans, Java Management Extensions (JMX), Java Native Interface (JNI), Math, Networking, Override Mechanism, Security, Serialization and Java for XML Processing (XML JAXP).
  • Lang and util base libraries, including lang and util, management, versioning, zip, instrument, reflection, Collections, Concurrency Utilities, Java Archive (JAR), Logging, Preferences API, Ref Objects and Regular Expressions.
  • Java Virtual Machine (JVM), including Java HotSpot Client and Server Virtual Machines.
The following actions occur at runtime.
  • Class LoaderThe Class Loader loads all necessary classes needed for the execution of a program. It provides security by separating the namespaces of the local file system from that imported through the network. These files are loaded either from a hard disk, a network or from other sources.
  • Byte Code VerifierThe JVM puts the code through the Byte Code Verifier that checks the format and checks for an illegal code. Illegal code, for example, is code that violates access rights on objects or violates the implementation of pointers.
    The Byte Code verifier ensures that the code adheres to the JVM specification and does not violate system integrity.
  • IntrepreterAt runtime the Byte Code is loaded, checked and run by the interpreter. The interpreter has the following two functions:
    • Execute the Byte Code
    • Make appropriate calls to the underlying hardware