BeginnersBook

  • Home
  • Java
    • Java OOPs
    • Java Collections
    • Java Examples
  • C
    • C Examples
  • C++
    • C++ Examples
  • DBMS
  • Computer Network
  • Python
    • Python Examples
  • More…
    • jQuery
    • Kotlin
    • WordPress
    • SEO
    • JSON
    • JSP
    • JSTL
    • Servlet
    • MongoDB
    • XML
    • Perl

JDK vs JRE vs JVM: Difference between them

By Chaitanya Singh | Filed Under: java

In this tutorial, you will learn the difference between JDK, JRE and JVM.

JDK (Java Development Kit)

JDK is a superset of JRE, it contains everything that JRE has along with development tools such as compiler, debugger etc.

  1. JDK stands for Java Development Kit. To install Java on your system, you need to first install JDK on your system.
  2. JDK contains the tools that you need, in order to write and execute java programs.
  3. JDK consists of Private JRE, JVM, compiler, Java application launcher, Appletviewer, etc. It also provides the Standard Edition (SE) of java API.
JDK

Features of JDK

  1. The JDK comes with a complete Java Runtime Environment (JRE), that is different from the regular JRE thats the reason it is usually called a private runtime so we can say that it includes all the features that JRE has.
  2. It has all the java development tools such as compiler, JVM, JRE, debugger etc.
  3. You need jdk in order to write and run java program.
  4. JDK supports multiple platforms and can be installed on Windows, Mac and other operating systems.

JRE (Java Runtime Environment)

JRE is the environment within which the java virtual machine runs. JRE contains Java virtual Machine(JVM), class libraries, and other files excluding development tools such as compiler and debugger.
Which means you can run the code in JRE but you can’t develop and compile the code in JRE.

  1. JRE stands for Java Runtime Environment. It provides runtime environment for java applications.
  2. You need JRE in order to run java programs. If you are not a developer and not writing java programs, you do not need JDK but you still need JRE to run java programs.
  3. All the JDK already comes with JRE so you do not need to download and install it separately.
  4. JRE contains set of libraries and other files that JVM uses at runtime.
JRE

Features of JRE

  1. JRE contains set of libraries and other tools that JVM needs at runtime.
  2. You can easily run any java program on JRE but you need jdk to write and compile java programs.
  3. JRE contains libraries that are required for integrations such as Java Database Connectivity (JDBC), Java Naming and Directory Interface (JNDI), Remote Method Invocation (RMI) etc.

JVM (Java Virtual Machine)

Java is a high level programming language. A program written in high level language cannot be run on any machine directly. First, it needs to be translated into that particular machine language. The javac compiler does this thing, it takes java program (.java file containing source code) and translates it into machine code (referred as byte code or .class file).

Java Virtual Machine (JVM) is a virtual machine that resides in the real machine (your computer) and the machine language for JVM is byte code. This makes it easier for compiler as it has to generate byte code for JVM rather than different machine code for each type of machine. JVM executes the byte code generated by compiler and produce output. JVM is the one that makes java platform independent.

Features of JVM

  1. JVM makes it possible to run java code on any machine, it is the JVM that makes java truly platform independent.
  2. It also allows to run java applications on cloud platforms.
  3. JDK and JRE both of these contain JVM.
  4. JVM is an interpreter as it executes the java code line by line.
  5. JVM converts the bytecode into machine code. JVM is platform independent as JVM doesn’t depend on the hardware and operating system of the machine.

How JVM works?

JVM

JVM Architecture

jvm architecture

Difference between JDK, JRE and JVM

JDKJREJVM
JDK stands for Java Development KitJRE stands for Java Runtime EnvironmentJVM stands for Java Virtual Machine.
It contains everything that JRE has along with development tools such as compiler, debugger etc.JRE contains Java virtual Machine(JVM), class libraries, and other files excluding development tools such as compiler and debugger.Java Virtual Machine (JVM) is a virtual machine that resides in the real machine (your computer) and the machine language for JVM is byte code
JDK is a superset of JREIt is a subset of JDK.JVM is a subset of JRE.
JDK is used to create and compile Java programs.JRE is a part of JDK that contains JVM.JVM is used to run the java code on any machine.
❮ C++ vs JavaJVM ❯

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Java Tutorial

Java Introduction

  • Java Index
  • Java Introduction
  • History of Java
  • Features of Java
  • C++ vs Java
  • JDK vs JRE vs JVM
  • JVM - Java Virtual Machine
  • First Java Program
  • Variables
  • Data Types
  • Operators

Java Flow Control

  • Java If-else
  • Java Switch-Case
  • Java For loop
  • Java while loop
  • Java do-while loop
  • Continue statement
  • break statement

Java Arrays

  • Java Arrays

OOPs Concepts

  • OOPs Concepts
  • Constructor
  • Java String
  • Static keyword
  • Inheritance
  • Types of inheritance
  • Aggregation
  • Association
  • Super Keyword
  • Method overloading
  • Method overriding
  • Overloading vs Overriding
  • Polymorphism
  • Types of polymorphism
  • Static and dynamic binding
  • Abstract class and methods
  • Interface
  • Abstract class vs interface
  • Encapsulation
  • Packages
  • Access modifiers
  • Garbage Collection
  • Inner classes
  • Static import
  • Static constructor

Java Exception Handling

  • Exception handling
  • Java try-catch
  • Java throw
  • Java throws
  • Checked and Unchecked Exceptions
  • Jav try catch finally
  • Exception Examples
  • Exception Propagation

Collections Framework

  • Collections in Java
  • Java ArrayList
  • Java LinkedList
  • Java Vector
  • Java HashSet
  • Java LinkedHashSet
  • Java TreeSet
  • Java HashMap
  • Java TreeMap
  • Java LinkedHashMap
  • Java Queue
  • Java PriorityQueue
  • Java Deque
  • Comparable interface
  • Comparator interface
  • Collections Interview Questions

MORE ...

  • Java Scanner Class
  • Java 8 Features
  • Java 9 Features
  • Java Conversion
  • Java Date
  • Java Multithreading
  • Java I/O
  • Java Serialization
  • Java Regex
  • Java AWT
  • Java Swing
  • Java Enum
  • Java Annotations
  • Java main method
  • Java Interview Q

Copyright © 2012 – 2022 BeginnersBook . Privacy Policy . Sitemap