Showing posts with label JVM. Show all posts
Showing posts with label JVM. Show all posts

Monday, February 27, 2017

Difference between JDK, JRE and JVM.

Hello viewers, Once again welcome back to Java Jagran. Today I am going to discuss "Difference between JDK, JRE and JVM". So Let's start:

JDK

  • JDK is an acronym for Java Development Kit. 
  • It physically exists. 
  • It contains JRE + development tools. 
JDK is also known as Java Development Kit which provides all necessary tools to develop any Java application as well as run it.

JRE

  • JRE is an acronym for Java Runtime Environment. 
  • It is used to provide a runtime environment. 
  • It is the implementation of JVM. 
  • It physically exists. 
  • It contains set of libraries + other files that JVM uses at runtime. 
  • Implementation of JVMs is also actively released by other companies besides Oracle.
Java Runtime Environment provides all necessary libraries and files which is required by JVM to execute any bytecode/.class file. For example: If you want to run any applet on your browser you have to install JRE on your system.

JVM


  • JVM (Java Virtual Machine) is an abstract machine. It is a specification that provides a runtime environment in which java bytecode can be executed.
  • JVMs are available for many hardware and software platforms. JVM, JRE and JDK are platform dependent because the configuration of each OS differs. But, Java is platform independent.
  • The JVM performs following main tasks:


    • Loads code
    • Verifies code
    • Executes code
    • Provides runtime environment
As a developer, we write a Java program i.e *.java file. Further, we compile the Java program and the *.class file is generated which is also known as bytecode. Now to execute this bytecode we need a something. But what exactly is that? Java Virtual Machine(JVM) is a virtual machine which runs the Java bytecode/.class file and generates the output.