What is JDK, JRE, JVM

What is the Java Development Kit (JDK)?

Java Development Kit (JDK) is a complete software environment for building applications and applets using the Java programming language. It is platform-dependent. Therefore, it has different OS platform versions for Windows, Linux, Mac, etc. It allows to read, write, and execute the java program.

  • It includes various tools required for writing Java programs.
  • It includes an Appletviewer, Java application launcher, debugger, compiler, etc.
  • JDK also consists of JRE for executing Java programs.
  • The Java application launcher helps in opening a JRE. Then, it loads the necessary details and executes the main method of the program.
JDK = Development Tools + JRE (Java Runtime Environment)
Source : naukri.com
Features of JDK
  • JDK provides an environment for developing and executing the Java source code.
  • It includes all the functionalities of JRE and JVM.
  • JDK helps developers to handle the exceptions using multiple extensions in a single catch block.
  • It has various other development tools like the debugger, compiler, etc.
  • It is platform-dependent. Moreover, any user can easily install JDK on Operating systems like Unix, Mac, Windows, etc.

What is Java Runtime Environment (JRE)?

JRE is software that includes JVM and class libraries to run java programs independently. Although it can execute the code. Yet, JRE comes bundled with Java development Kit (JDK) to provide a complete application development experience.

  • The JRE includes class libraries along with JVM and its supporting files. Note: It does not include separate tools such as a debugger for Java development.
  • JRE comprises significant package classes such as util, math, AWT, lang, and various runtime libraries.
JRE = JVM + Class Libraries (For Running the Java Applications).
jdk
Source : naukri.com
Features of JRE
  • JRE consists of a set of tools to help the JVM run. In addition, it includes a few deployment tools such as Java Plug-in and Java Web Start.
  • A User can efficiently run a java code with JRE only. However, JRE doesn’t allow writing the program.
  • JRE appends various integration libraries like the JDBC (Java Database Connectivity), JNDI (Java Naming and Directory Interface), RMI (Remote Method Invocation), etc.
  • Along with JVM, it consists of a virtual machine client for Java HotSpot.

What is Java Virtual Machine (JVM)?

Java Virtual Machine (JVM) is an abstract machine responsible for compiling and executing Java code. It is a part of the Java Runtime Environment (JRE) which calls the main function of a program.

  • JVM facilitates a platform-independent way of executing Java source code. Its basis on WORA (Write Once Run Anywhere).
  • It has a class loader, runtime data area, execution engine, and libraries.
  • JVM comes with JIT(Just-in-Time) compiler that converts Java source code into machine code.
program-execution

First, the java compiler compiles a Java file into a Java .class file. Then the .class file works as an input into the JVM, which loads and executes the class file.

Java Virtual Machine Architecture (TBD)

The JVM consists of three distinct components:

  1. Class Loader Subsystem is responsible for loading, linking and initializing a Java class file (i.e., “Java file”), otherwise known as dynamic class loading.
  2. Runtime Data Areas contain method areas, PC registers, stack areas and threads.
  3. Execution Engine contains an interpreter, compiler and garbage collection area.
jvm
Source : naukri.com
Features of JVM
  • It converts byte code to the machine language.
  • JVM provides basic java functions like memory management, security, garbage collection, etc.
  • Runs the program by utilizing JRE’s libraries and files.
  • JVM is an integral part of JRE.
  • It can execute the java program line by line. Therefore, it is also known as an interpreter.
  • The main functions of JVM include loading, linking, initializing, and compiling the program.

Note: JVM can’t be installed alone. As JVM is a part of JRE, you need to install JRE. JVM comes within it.

Difference between JDK, JRE and JVM
JDKJREJVM
The full form of JDK is Java Development Kit.The full form of JRE is Java Runtime Environment.The full form of JVM is Java Virtual Machine.
JDK is a software development kit to develop applications in Java.It is a software bundle which provides Java class libraries with necessary components to run Java code.JVM executes Java byte code and provides an environment for executing it.
JDK is platform dependent.JRE is also platform dependent.JVM is highly platform dependent.
It contains tools for developing, debugging, and monitoring java code.It contains class libraries and other supporting files that JVM requires to execute the program.Software development tools are not included in JVM.
It is the superset of JREIt is the subset of JDK.JVM is a subset of JRE.
The JDK enables developers to create Java programs that can be executed and run by the JRE and JVM.The JRE is the part of Java that creates the JVM.It is the Java platform component that executes source code.
JDK comes with the installer.JRE only contain environment to execute source code.JVM bundled in both software JDK and JRE.
Source : guru99.com
Reference

Leave a comment

Design a site like this with WordPress.com
Get started