jdk vs jre vs jvm

Let’s start by defining JDK (Java Development Kit), JRE (Java Runtime Environment), and JVM (Java Virtual Machine).

JDK (Java Development Kit)

JDK contains everything that will be required to develop and run Java application.

JRE (Java Run time Environment)

JRE contains everything required to run Java application which has already been compiled. It doesn’t contain the code library required to develop Java application.

JVM (Java Virtual Machine)

JVM is a virtual machine which work on top of your operating system to provide a recommended environment for your compiled Java code. JVM only works with bytecode. Hence you need to compile your Java application(.java) so that it can be converted to bytecode format (also known as the .class file). Which then will be used by JVM to run application. JVM only provide the environment It needs the Java code library to run applications.

JDK vs JRE vs JVM

The below chart shows the different features of each of the Java technologies.

JDK_JRE_JVM

*Image Courtesy : Oracle Corporation

Now as per diagram you can identify what is the difference.

JRE = JVM + Required Library to run Application.

JDK = JRE + Required Library to develop Java Application.

Java Portability

In order to understand portability in Java you need to understand what happens to java code from start to finish.

1- Java Source Code (Written by Developer) (Machine Neutral)

2- Compiled Code / Byte Code (Compiled by javac) . (Machine Neutral)

3- Byte Code executed (Executed by JVM) (Machine Specific)

In step 2, javac (Java Compiler) converts Java code to byte code. This can be moved to any machine(Windows / Linux) and executed by JVM. JVM reads the bytecode and generates machine specific code. In order to generate machine specific code JVM needs to be machine specific. So every type of Machine(Windows / Linux / Mac) has a specific JVM. So in this way the coder doesn’t need to bother with generating byte code. JVM takes care of portability. So the final answer is Java is Portable but JVM is Machine Specific.

Series Navigation<< Java Basics:Getting Started with JavaJava Class & Object Tutorial for beginners >>
By | 2017-07-22T23:22:06+00:00 July 22nd, 2015|Core Java|29 Comments

About the Author:

29 Comments

  1. Huu Chi July 22, 2015 at 3:47 pm - Reply

    This is new chapter for Core Java?

  2. loku July 23, 2015 at 10:46 am - Reply

    This is a great article to know the basics differences between all these three main terms. Liked it. Keep going on!!

  3. jason July 26, 2015 at 12:02 am - Reply

    Great article thanks

  4. Vijay G July 30, 2015 at 8:22 am - Reply

    It is very simple but explains crystal clear about the basics of jdk, jre and jvm… Anyone can understand so easily…

  5. richa September 2, 2015 at 11:58 am - Reply

    Clear nd easy to understand..

  6. Nandu September 23, 2015 at 8:04 pm - Reply

    Hi,

    I am very new beginner for java…This is very nice tutorial.

    I need some clarification reg JDK,JRE and JVM

    As you said, JRE is combination of specific libraries(math and util) and JVM,

    For a simple HELLO WORLD program ,will javac and JVM be enough to compile and get the result as there is no use of specific libraries in evaluating the result?

    Cheers,
    Nandu

    • J Singh September 26, 2015 at 2:40 pm - Reply

      Hi Nandu,

      Sorry for late reply. As per your question it might look like you only need only javac and JVM. But truth is even if you don’t import any library there are some libraries which will be imported implicitly. and you will require some basic libraries even for simplest application.
      Hope it clarifies.

      Regards

  7. sushma December 31, 2015 at 11:02 am - Reply

    very clear and easy to understand.

  8. mahendra January 5, 2016 at 6:10 am - Reply

    awsm article sir..now clearly understand the concept of java portability.
    thank you sir!!!

  9. kakarlapudi balaji raju January 27, 2016 at 10:58 am - Reply

    any body can understand

  10. Snigdah Dash January 29, 2016 at 6:02 am - Reply

    Crystal clear comparision. Easy to understand..

  11. sandeep February 24, 2016 at 12:41 pm - Reply

    very nice article, thanks for sharing this

  12. avnika February 26, 2016 at 10:58 am - Reply

    Nice to understand.. i would like to learn core java need online classes if possible to you can you please share your details

    • J Singh February 28, 2016 at 11:31 am - Reply

      Hi Avnika,

      I organize online classes time to time. But that will be paid and 800₹/hr.


      Regards

  13. Poomaran February 27, 2016 at 6:56 am - Reply

    Simple and Clear…

    Wisely done. Thanks.

  14. susmitha February 29, 2016 at 6:34 am - Reply

    Very clear. Nice article

  15. vrushali February 29, 2016 at 5:39 pm - Reply

    its really very helpful for beginner. awsm article. really thakful

  16. kashif April 5, 2016 at 12:19 pm - Reply

    Dear author,
    You’ve spent so much effort putting all this up, which can become even better with some editing, especially punctuation and sentence flow.
    it’s just a suggestion. Keep up the good work!

    • J Singh April 9, 2016 at 1:37 pm - Reply

      I do agree with you there are problems with articles. And we have just started working on that. We can’t revisit all old articles. But we are trying touch base and correct article as much as possible. Thanks for your suggestion though.

      Regards

  17. HOMER May 4, 2016 at 1:03 pm - Reply

    y’all are so awesome at this i’m really getting the hang of this it’s really FUN

  18. komal July 7, 2016 at 9:04 am - Reply

    helpful

  19. krishna July 13, 2016 at 10:10 am - Reply

    I want more information about jdk jvm and jre..

  20. Mr.Khun Nyan Thein July 20, 2016 at 4:06 am - Reply

    Good thank you so much!!!

  21. Sindhu August 7, 2016 at 1:43 pm - Reply

    Cannot download the Ebook .please help me
    Also, is it up to the date ..?

    • J Singh September 3, 2016 at 10:14 am - Reply

      What problem are you facing ??

  22. Hussain August 18, 2016 at 12:40 pm - Reply

    So much beginer content.

  23. Girish Barhate September 22, 2016 at 7:25 am - Reply

    very Easy to learn

  24. apexa October 4, 2016 at 8:18 am - Reply

    it is really very helpful thank you..

  25. Ranjita July 31, 2017 at 7:48 pm - Reply

    So clear and easy to understand, Thank you

Leave A Comment