Computer >> Computer tutorials >  >> Programming >> Java

Differences between JDK, JRE and JVM.


All three JDK, JRE and JVM are interdependent and there is no common point so it is not effective to state their difference in the tabular form however we will discuss these in following paragraphs.

JVM

JVM is the abbreviation for Java virtual machine which is basically specification that provides a runtime environment in which Java byte code can be executed i.e it is something which is abstract and its implementation is independent to choose the algorithm and has been provided by Sun and other companies. It is JVM which is responsible for converting Byte code to the machine specific code. It can also run those programs which are written in other languages and compiled to Java bytecode.The JVM performs the mentioned tasks: Loads code, Verifies code, Executes code, Provides runtime environment.

JRE

JRE is Java runtime environment which is the implementation of JVM i.e the specifications which are defined in JVM are implemented and creates corresponding environment for the execution of code.JRE comprises mainly java binaries and other classes to execute the program alike of JVM it physically exists. Along with Java binaries JRE also consist of various technologies of deployment, user interfaces to interact with code executed, some base libraries for different functionalities and language and util based libraries.

JDK

JDK is abbreviation for Java Development Kit which includes all the tools, executable and binaries required to compile, debug and execute a Java Program.JDK is platform dependent i.e there is separate installers for Windows, Mac, and Unix systems.JDK includes both JVM and JRE and is entirely responsible for code execution. It is the version of JDK which represent version of Java.

Following are the important differences between JDK,JRE and JVM

Sr. No.
Key
JDK
JRE
JVM
1
Definition
JDK (Java Development Kit) is a software development kit to develop applications in Java. In addition to JRE, JDK also contains number of development tools (compilers, JavaDoc, Java Debugger etc.).
JRE (Java Runtime Environment) is the implementation of JVM and is defined as a software package that provides Java class libraries, along with Java Virtual Machine (JVM), and other components to run applications written in Java programming.
JVM (Java Virtual Machine) is an abstract machine that is platform-dependent and has three notions as a specification, a document that describes requirement of JVM implementation, implementation, a computer program that meets JVM requirements, and instance, an implementation that executes Java byte code provides a runtime environment for executing Java byte code.
2
Prime functionality
JDK is primarily used for code execution and has prime functionality of development.
On other hand JRE is majorly responsible for creating environment for code execution.
JVM on other hand specifies all the implementations and responsible to provide these implementations to JRE.
3
Platform Independence
JDK is platform dependent i.e for different platforms different JDK required.
Like of JDK JRE is also platform dependent.
JVM is platform independent.
4
Tools
As JDK is responsible for prime development so it contains tools for developing, debugging and monitoring java application.
On other hand JRE does not contain tools such as compiler or debugger etc. Rather it contains class libraries and other supporting files that JVM requires to run the program.
JVM does not include software development tools.
5
Implementation
JDK = Java Runtime Environment (JRE) + Development tools
JRE = Java Virtual Machine (JVM) + Libraries to run the application
JVM = Only Runtime environment for executing the Java byte code.