Differentiate JVM JRE JDK JIT

Last modified on March 9th, 2016 by Joe.

In this article you will learn about what is JVM, JRE, JDK and JIT in Java. Also about the differences between them.

JVM becomes an instance of JRE at runtime of a Java program. It is widely known as a runtime interpreter. The Java virtual machine (JVM) is the cornerstone on top of which the Java technology is built upon. It is the component of the Java technology responsible for its hardware and platform independence. JVM largely helps in the abstraction of inner implementation from the programmers who make use of libraries for their programmes from JDK.

Difference between JVM JRE JDK JIT

JVM Internals

Like a real computing machine, JVM has an instruction set and manipulates various memory areas at run time. Thus for different hardware platforms one has corresponding implementation of JVM available as vendor supplied JREs. It is common to implement a programming language using a virtual machine.

A Java virtual machine instruction consists of an opcode specifying the operation to be performed, followed by zero or more operands embodying values to be operated upon. From the point of view of a compiler, the Java Virtual Machine (JVM)is just another processor with an instruction set, Java bytecode, for which code can be generated. Life cycle is as follows, source code to byte code to be interpreted by the JRE and gets converted to the platform specific executable ones.

Sun’s JVM

Sun’s implementations of the Java virtual machine (JVM) is itself called as JRE. Sun’s JRE is available as a separate application and also available as part of JDK. Sun’s Java Development Tool Kit (JDK) comes with utility tools for byte code compilation “javac”. Then execution of the byte codes through java program using “java” and many more utilities found in the binary directory of JDK. ‘java’ tools forks the JRE. Implementation of JVMs are also actively released by other companies besides Sun Micro Systems.

JVM for other languages

A JVM can also be used to implement programming languages other than Java. For example, Ada source code can be compiled to Java bytecode, which may then be executed by a Java virtual machine (JVM).  That is, any language with functionality that can be expressed in terms of a valid class file can be hosted by the Java virtual machine (JVM). Attracted by a generally available, machine-independent platform, implementers of other languages are turning to the Java virtual machine (JVM) as a delivery vehicle for their languages.

Just-in-time Compiler (JIT)

JIT is the part of the Java Virtual Machine (JVM) that is used to speed up the execution time. JIT compiles parts of the byte code that have similar functionality at the same time, and hence reduces the amount of time needed for compilation. Here the term “compiler” refers to a translator from the instruction set of a Java virtual machine (JVM) to the instruction set of a specific CPU.

Comments on "Differentiate JVM JRE JDK JIT"

  1. Srikanth S says:

    Hi Joe,

    Explanation on each are really good.

    Thanks and Regards
    Srikanth S

  2. Shreyas says:

    The picture about the implementation is good. However, I read in the first paragrapth tha JRE is an implementation of JVM and in the very next the I read the reverse of it.

    Can you confirm if JRE is the implementation of JVM or JVM is the implementation of JRE?

    Also, if JRE is an implementation of JVM, then I assue [JDK, JIT, Compiler] will all come under JDK.

    Please confirm my understanding.

  3. Joe says:

    What you read in the first paragraph and in the next paragraph means the same.

    “Java Runtime Environment (JRE) is an implementation of the JVM”. “JVM becomes an instance of JRE at runtime”. These are the two statements you are referring to.

    They mean the same. If the second statement is confusing to understand the relationship between jvm and jre, just ignore it. If you understand the larger picture that “Java Runtime Environment (JRE) is an implementation of the JVM” is good.

    Over a period, you will digest the complete relationship and difference between jre and jvm.

  4. Anonymous says:

    Realy a nice Explainasion ………

  5. Amol Bhuibhar says:

    I like ur explainasion…..it realy anice one….thnks 4 it.

  6. Mahesh says:

    The information is really help. Good Work

  7. pooja says:

    The explaination given is really very good. reading it my most of the concepts are more clear nwo.Thanks

  8. CHAITALI JADHAV says:

    JIT is the part of the Java Virtual Machine (JVM) that is used to speed up the execution time. JIT compiles parts of the byte code that have similar functionality at the same time, and hence reduces the amount of time needed for compilation. Here the term “compiler” refers to a translator from the instruction set of a Java virtual machine (JVM) to the instruction set of a specific CPU.

  9. santhosh says:

    good explanaton….
    i want to seperate jre from the given java software.. is this possible???

  10. Thimmappa says:

    nice explanation ……with picture….it is so helpful……

  11. Abhi says:

    your information really help me for knowing the internal working of jvm & all other..!!!
    Thank u

  12. Prerna says:

    very nice description. Provide some data for java IO stream classes…..

  13. PRIYA says:

    thanks very much

  14. Tushar Singh says:

    Thank you, This is the really good explation with the pictures

  15. vt says:

    I have a doubt…

    Java Virtual Machine (JVM) is interpreter But Just-in-time Compiler is the compiler.. Why both Interpreter and Compiler both are needed?
    What Functions are done by JVM and what are done by JIT?

  16. Manu says:

    thaks… its really usefull..

  17. Divya says:

    In the Diagram what is meant by java compiler is it not at all related to Jvm?

  18. gautam says:

    Thanks a ton dewd…

    peace!

  19. Ankit Sharma says:

    not very clear specification,but good effort

  20. rajasekhar says:

    hello sir, Your explanations are very nice and they are easy to understand

  21. TAPAN says:

    thanks shrikant

  22. Abhishek kumar verma says:

    well… i love the way you explore things….
    thanks a lot sir for providing us such a good information of Java..

  23. shri says:

    gr8 explanation… just loved it.. :)

  24. Ram patidar says:

    hiiiiiii,,,,.
    i got a Question in test.that is
    what is JVM.JVM is Compiler or
    interpreter

  25. chandu says:

    Hi Sir,
    your Explanation about jvm,jre are very excelent sir..

    thank you

  26. Durgesh says:

    hii…..joe…thnx for explntion….
    it was gr8…..thnx again..

  27. venkat says:

    nice explanation with diagram

  28. amar bhukya says:

    hi…
    Explanation on each are really very
    good.

    Thanks and Regards

  29. Shishir Gupta says:

    Hi Joe…..your way of explanation is good but still there is a little bit confusion in my mind that what do you mean by jre is instantiate of jvm at runtime and how a java application can access OS library function…..Will you please more elaborate it for me???

  30. Himakumar says:

    your teching is simply super very use full

  31. manasi says:

    joe,
    nice explanation man.
    tahnks

  32. Kiran Kadav says:

    Very Nice Explanation.
    I Have 1 Doubt…
    Who calls Main method compiler or Interpreter???

  33. Karpagavalli says:

    Thank u for ur answer sir..
    Plz post me new blogs of u..

  34. […] the above two phases are complete, java virtual machine […]

  35. Rajesh says:

    Nice explanation.
    Thanks for the article Joe!

  36. chandrashekar says:

    excellent explanation

    thank you sir

    chandrashekar

  37. karthik says:

    i want to become a java developer…how to i learn the java in easy way?please tell me

  38. Anonymous says:

    nice material

  39. siva says:

    nice

  40. venkateshan says:

    really nice and usefull to us thank you :)

  41. padma says:

    This website is really nice.It’s very helpful for pepole who are learning java.

  42. anurag says:

    Hi Joe ,

    The article is nice.

    Can you tell me that, which one among three of them is plat form independent and plateform dependent (JRE,JVM,JDK).

    waiting for your replay.

    Thanks,
    Anurag

  43. Amit says:

    Is JVM is platform independent?

  44. jamalaiah says:

    nice,
    thanks for good explanation.

  45. veera says:

    i want ur core java total information

  46. shekhar tyagi says:

    jdk is used for compilation of source code?

  47. santosh nikam says:

    really to the point answer

  48. Prabu says:

    Sir ..
    jdk makes class file into bye code.
    so jdk acts as a compiler.

    which one acts as a interpreter..? jre or jvm?
    what do jvm and jre do?
    is jvm equipped with jre?

    Replu pls sir..thanks in advance…

  49. Prabu says:

    Hello Where is My previous comments………..?

  50. Prabu says:

    Where is my previous questions posted in this ?

  51. santhosh reddy says:

    really great relationships between them. u made them very clear in a clear and perfect diagram no need to go through the paragraphs nice job joe :-)

  52. Sandip says:

    Impressed with you blog!! Excellent job

  53. Manikanda Prabhu A says:

    Thank you very much for the clear explaination.

  54. Kavi says:

    Crispy definitions and easy to understand.And the pictorial representation is so good.

  55. Ashu says:

    Nice explaination joe…..but need to know, why the main method in java is static.?
    plz tel me…

  56. Zaid says:

    @Ashu because the main() method needs to be invoked before the class containing the main method is instantiated or in other words the object of that class is created……static methods can be called by the class name…..therefore the Run-time system calls the main method(the entry point of the program ) without the need to waste an object….

  57. Zaid says:

    Joe, when you say that JVM is an implementation of JRE you mean to say at real-time…

  58. Joe says:

    Yes Zaid, you are right.

  59. Anu says:

    hai joe,
    Explanation really nice.clear cut definition and easy to understand by new learner of java

  60. shobhit says:

    nyc explaination…

  61. Jay says:

    Awesome Explanation… Thnx :)

  62. annonymus says:

    please tell about java interpreter?

  63. randy says:

    in jvm,byte code initially handled by interpreter or JIT ?

    please.. explain the relation of interpreter and JIT ?

  64. […] We need to know about jvm.dll also. This is the actual java virtual machine implementation in windows environment and it is part of the JRE. A ‘C’ program can use this jvm.dll directly to run the jvm. […]

  65. ponna says:

    good explanation yaar.. thanks

  66. Mridul.K.P says:

    Nice easy to undersatnd :)

  67. Anjali says:

    I like all your articles. Your site has lots of them which explain the java basics well. Thank you Joe. Keep going :)

  68. Srikanth D says:

    Hi Joe,
    I have a question..
    In the first paragraph you have mentioned that “Java Development Kit (JDK) contains JRE along with various development tools” and in the diagram you have specified them as two different entities. Could you please elaborate?

  69. Unknown says:

    Hi Joe,

    Could you please add some more details because this information creates little bit confusion in understanding.

  70. Anonymous says:

    hey…It’ really very good…and you should add some more details about JDK versions too

  71. Rhushi says:

    thanks joe.
    quite useful and upto remarks.
    have funday.

  72. Joe says:

    For JDK versions, I have written a separate detailed article which you can refer:

    https://javapapers.com/core-java/java-features-and-history/

  73. masood says:

    hi am new to java .. pls bring me real time examples for OOPS concept and how can we use that in project pls help me out

  74. ahamed shaik says:

    hi…joe
    ur explanation is really good..

    please tell me weather jvm acts as a compiler or interpreter ??

  75. ramasrinu says:

    hi joe thank u very much….u r blog helps to us to eleminate confusions in understanding.

  76. Domnic Sundar J says:

    Hi ahamed,

    As of my understanding, JVM will act as a interpreter only not as compiler work.

    Compiler will compile the source file to class file and it is placed inside JDK not JRE.(C:\Program Files\Java\jdk1.6.0_18\bin\javac)

    TO run the source file:
    e.g C:\Program Files\Java\jdk1.6.0_18\bin\javac Domnic.java or javac Domnic.java

  77. Tamilselvi says:

    Hi Joe
    your website creation is too good. Explanation is very user-friendly. :-) KEEP ROCKIN…!!!!

  78. Sanjap Patel says:

    Really i like the all explanation given by You!

    Its better for learner as well as the professional who don’t have much idea about about JVM.

    Regards,
    Sanjay Patel
    Software Engineer (Pune,India)

  79. Miller says:

    really good explanation.. all my doubts are cleared now.. thankzz

  80. Salman says:

    Really after reading some explanations this is very beneficial at fresher level…thnk u sir and pls tell me about ur next blog

  81. ahamed shaik says:

    @Domnic Sundar J

    thanq 4 ur explaination :)

  82. Narendra Ch says:

    Hi Joe.. The explanation regarding the JIT compiler is really good… appriciate your hardwork.Even gone thru your profile…Really so interesting.

  83. Chandan says:

    Hi Joe, Finally you made me understand these confused terms in more simpler way.

    Thanks,
    Chandan

  84. […] can be thrown by either java run time environment or by the code itself. JRE throws exception when java’s rules are violated. An example is, when the code accesses an […]

  85. youngto says:

    The article very good.

  86. Amar Sannaik says:

    can you please confirm my understanding on different JVM implementation.

    There are different implementation because JVM needs to manipulate various memory areas at runtime which are specific to different hardwares.

    Also in an interview I have been asked, why there are different implementation of JDK available each for OS like Windows, Linux. All I could answer is they have different files format. But can you please say list other reasons for my understanding.

    Thanks in advance.

  87. Deepak Pandey says:

    this is useful..the explanation is really gr8 with figure.
    thank u

  88. dk boss says:

    awesome explanation but can anybody tell me compilation is more faster than interpretation or not?

  89. DMahesh says:

    Sir,
    This site is lot of helpful to me for Preparing for Interviews.
    Thank’s for your Development

  90. Shailesh Saxena (Pilibhit, India) says:

    Hi,
    I appreciate your efforts, and thank you for providing such a nice explanation. But being frank, I really feel that still the difference in terms is not that much clear.
    How the code is compiled, read and converted from byte code into underlying OS related format. What is clear role of JIT. and how JIT works along with JVM. All these questions are still hammering my mind.
    If possible please let me know.
    Thanks & Regards

  91. Abhilash says:

    I am working in an ecommerce site so can you provide me the best guide to follow for learning java

  92. Joe says:

    Java language specification is the best guide to go with.

  93. Amit Mulay says:

    Why JIT is called compiler when it is an Interpreter?

  94. punta says:

    hi joe, your website theme is really cool, i like this idea of the notebook, the javacup and the other graphbook pages used for the search.its really creative!! is it a wordpress customized theme?

  95. vijendra says:

    very nice article.. but i have a question if I have java installed in my machine , lets say java5.0 and now i am upgrading it to java 7 so when I download the exe from oracle website than at that time there were only one more folder added to my program files that contain jre7 but i do not understand if i compiled a program containing syntax of java 7 than at that time how can old jdk can compile that? I agreed that I have jre7(the latest downloaded) but my jdk folder is still older one and javac compiler is there in jdk folder. so i am quiet curious to know that how an old compiler can compile the newer version of code.

  96. JavaWiz says:

    Thanks for the good article.
    Correction – the original JVM is not a component of java technology, its on negative language, ANSI C and hence its a platform dependence.

  97. Priyank Jain says:

    The Sun JVM is written in C, the JVM as it runs on your machine is a platform-dependent executable.
    original IBM JVM was written in Smalltalk

  98. Balaji says:

    Thank you Joe…Cool exp

  99. Gagan Mani says:

    Hi Joe,

    Excellent explanation that is very important for every Java developer.

  100. Wasim Akram says:

    Hi Joe,
    U r doing gr8 job. This is very nice explanation.
    Keep it up.

  101. Siva kumar says:

    Hi Joe,

    Superv explanation. I got clear cut idea with your explanation..

  102. Rajeev says:

    Hi Joe,

    Simple explanation but worthy. Thank you.

  103. Anonymous says:

    Good explanation
    Thank You

  104. Anonymous says:

    Both JD Kand JVM are platform dependent

  105. Ayaskant says:

    Wonderful post. But I have a confusion. Why does JVM use JIT? Is it due the fact that JVM alone is an interpreter & not a translator like JIT? i.e. It cannot translate the intermediate byte-code in to machine instructions?

    JIT is a translator. It translates the byte-code to machine instructions at run time & also caches the compiled instruction.

    What will happen if JVM does not uses JIT? Will the byte-code directly run on the underlying hardware?

  106. DPREDDY says:

    Hi JOE,

    Coul youu please expalin exactly how jvm is internally working?

  107. […] object can be customized. out gets initialized by java runtime environment at startup and it can be changed by developer during execution. Instead of standard output, in […]

  108. Aditya says:

    Nice work!!!

  109. GG says:

    Hi Joe,

    I wanted to check if I understand the diagram correctly. If JVM is part of JRE, and JRE is a part of JDK, then in the diagram given above, would all the components interacting with eachother lie under JDK?

  110. Vinod says:

    Hi Amit,
    JIT is not an interpreter. Newer JVM comes with JIT rather than interpreter. Interpreter is a old concept.

  111. Vinod says:

    Hi Joe ,

    Thanks a lot for a very nice post.You are an inspiration.
    I have wrote a small blog , a part of my learning java language about “Just in Time Compiler”please review and add your comments.

  112. Anonymous says:

    I fee its better to draw one more arrow fro JDK to JRE.
    because to compile the class JDK depends needs on the classes provide by JRE (Ex- System, Integer, etc …)

  113. Gaurav says:

    the explanation was really good. i understood the pattern how really does it work however i am not able to install Netbean on my windows 8 based system. Could you please give me some assistance on it. :)

  114. Madhusudhanan says:

    Thanks Joe for the brief explanation

  115. Moin says:

    Joe ..keep up the good work ! I prefer javapapers over many :)

  116. gauravc says:

    jre is platform dependent in java…………..
    by jre your program made avliable for all os.sp java is platform independent.

  117. Avinash desai says:

    I have installed JDK 1.7, when i complie the java program it shows the message that “javac is not a part of internal or external command ”
    what is the reason behind this?

  118. lucky says:

    i want to know complete process, from source code to output and role of each ,javac jit jvm class loader byte code varifier . it had quiet confused me i want to clear my concept please explain .
    Thanx :-)

  119. kushi says:

    Hi,
    When we download eclipse, isnt JDK installed along with it? Coz under C:\Program Files\ I find only JRE.. To see decompiled class information of JAVA like String class, my understanding is I have to attach the location of src.zip and for that I require JDK.

  120. vineela says:

    set the path to java in command prompt by taking the url of bin folder where the java software has installed.

    or
    set path as
    computer->properties->adv system settings->environmental variables->user settings->click on edit->type
    name=path
    value=c:\program files\java\jdk\bin

  121. abhihek says:

    hi avinash , u got this message because u didn’t incuded java libraries.
    now what u have to do is.
    1. simply save ur java files in jre 1.8 folder which is present in
    c:program files:java:jre 1.8
    and then include this path from command prompt by using CD command.
    ur’s command prompt should have at last
    c:program files:java:jre 1.8:—

  122. Saurabh says:

    Life Cycle of JVM :

    When a Java application starts, a runtime instance is born. When the application completes, the instance dies. If you start three Java applications at the same time, on the same computer, using the same concrete implementation, you’ll get three Java virtual machine instances. Each Java application runs inside its own Java virtual machine.

    For Example :

    If we have a Node manager which contains 3 Managed server having instance of JVM, then there will be 3 instance of JVM running on managed server, all of them will be pointing to the Node manager.

    The source code is first written in plain text files ending with the .java extension. Those source files are then compiled into .class files by the javac compiler. A .class file does not contain code that is native to your processor; it instead contains bytecodes — the machine language of the Java Virtual Machine (Java VM). The java launcher tool then runs your application with an instance of the Java Virtual Machine.

  123. Anonymous says:

    u can set the class path

Comments are closed for "Differentiate JVM JRE JDK JIT".