JDK, JRE and JVM are three important components that are core to building and running application programs using Java programming language. For beginners starting with Java, it is important that we must what is the role of each of these blocks and the simple differences between these.
Java is a compiled and strongly typed object oriented programming language.
This means that Java –
- Has a strict type system which consists of predefined types to define and maintain data.
- Follows Object Oriented Pattern for writing programs
- Follows a two step – Compilation followed by an Interpretation for executing a program
The last point – Compilation followed by an Interpretation is where these three components come into picture.
What is Java Development Kit (JDK)
JDK stands for Java Development Kit. It is a software development environment, used to develop Java applications and applets. It contains JRE (Java Runtime Environment) and development tools to develop applications.
The JDK contains the Java Compiler (javac) that is responsible for compiling the Java source code into an intermediate called bytecode.
What is a Java Virtual Machine (JVM)
In Java, a compilation step converts the Java source code into an intermediate called bytecode. This bytecode can run on any machine and any environment where Java is available.
JVM is the abstraction layer between a Java application and the underlying platform. It acts as a “virtual” machine to a bytecode that contains the program to run. This enables Java to run on any platform, without having to worry about the underlying environment.
What is a Java Runtime Environment (JRE)
JRE stands for Java Runtime Environment. It provides the runtime environment to run java applications. It is the combination of JVM and set of libraries to which will be used to run application.
In Summary –
- JDK / Java Development Kit is a software development kit that contains both the compiler and the runtime
- JVM is the abstraction layer between a Java application and the underlying platform that helps run the bytecode
- JRE is the combination of JVM and a set of libraries to which will be used to run application