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.
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 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.
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.
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 are closed for "Differentiate JVM JRE JDK JIT".
Hi Joe,
Explanation on each are really good.
Thanks and Regards
Srikanth S
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.
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.
Realy a nice Explainasion ………
I like ur explainasion…..it realy anice one….thnks 4 it.
The information is really help. Good Work
The explaination given is really very good. reading it my most of the concepts are more clear nwo.Thanks
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.
good explanaton….
i want to seperate jre from the given java software.. is this possible???
nice explanation ……with picture….it is so helpful……
your information really help me for knowing the internal working of jvm & all other..!!!
Thank u
very nice description. Provide some data for java IO stream classes…..
thanks very much
Thank you, This is the really good explation with the pictures
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?
thaks… its really usefull..
In the Diagram what is meant by java compiler is it not at all related to Jvm?
Thanks a ton dewd…
peace!
not very clear specification,but good effort
hello sir, Your explanations are very nice and they are easy to understand
thanks shrikant
well… i love the way you explore things….
thanks a lot sir for providing us such a good information of Java..
gr8 explanation… just loved it.. :)
hiiiiiii,,,,.
i got a Question in test.that is
what is JVM.JVM is Compiler or
interpreter
Hi Sir,
your Explanation about jvm,jre are very excelent sir..
thank you
hii…..joe…thnx for explntion….
it was gr8…..thnx again..
nice explanation with diagram
hi…
Explanation on each are really very
good.
Thanks and Regards
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???
your teching is simply super very use full
joe,
nice explanation man.
tahnks
Very Nice Explanation.
I Have 1 Doubt…
Who calls Main method compiler or Interpreter???
Thank u for ur answer sir..
Plz post me new blogs of u..
[…] the above two phases are complete, java virtual machine […]
Nice explanation.
Thanks for the article Joe!
excellent explanation
thank you sir
chandrashekar
i want to become a java developer…how to i learn the java in easy way?please tell me
nice material
nice
really nice and usefull to us thank you :)
This website is really nice.It’s very helpful for pepole who are learning java.
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
Is JVM is platform independent?
nice,
thanks for good explanation.
i want ur core java total information
jdk is used for compilation of source code?
really to the point answer
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…
Hello Where is My previous comments………..?
Where is my previous questions posted in this ?
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 :-)
Impressed with you blog!! Excellent job
Thank you very much for the clear explaination.
Crispy definitions and easy to understand.And the pictorial representation is so good.
Nice explaination joe…..but need to know, why the main method in java is static.?
plz tel me…
@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….
Joe, when you say that JVM is an implementation of JRE you mean to say at real-time…
Yes Zaid, you are right.
hai joe,
Explanation really nice.clear cut definition and easy to understand by new learner of java
nyc explaination…
Awesome Explanation… Thnx :)
please tell about java interpreter?
in jvm,byte code initially handled by interpreter or JIT ?
please.. explain the relation of interpreter and JIT ?
[…] 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. […]
good explanation yaar.. thanks
Nice easy to undersatnd :)
I like all your articles. Your site has lots of them which explain the java basics well. Thank you Joe. Keep going :)
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?
Hi Joe,
Could you please add some more details because this information creates little bit confusion in understanding.
hey…It’ really very good…and you should add some more details about JDK versions too
thanks joe.
quite useful and upto remarks.
have funday.
For JDK versions, I have written a separate detailed article which you can refer:
https://javapapers.com/core-java/java-features-and-history/
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
hi…joe
ur explanation is really good..
please tell me weather jvm acts as a compiler or interpreter ??
hi joe thank u very much….u r blog helps to us to eleminate confusions in understanding.
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
Hi Joe
your website creation is too good. Explanation is very user-friendly. :-) KEEP ROCKIN…!!!!
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)
really good explanation.. all my doubts are cleared now.. thankzz
Really after reading some explanations this is very beneficial at fresher level…thnk u sir and pls tell me about ur next blog
@Domnic Sundar J
thanq 4 ur explaination :)
Hi Joe.. The explanation regarding the JIT compiler is really good… appriciate your hardwork.Even gone thru your profile…Really so interesting.
Hi Joe, Finally you made me understand these confused terms in more simpler way.
Thanks,
Chandan
[…] 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 […]
The article very good.
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.
this is useful..the explanation is really gr8 with figure.
thank u
awesome explanation but can anybody tell me compilation is more faster than interpretation or not?
Sir,
This site is lot of helpful to me for Preparing for Interviews.
Thank’s for your Development
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
I am working in an ecommerce site so can you provide me the best guide to follow for learning java
Java language specification is the best guide to go with.
Why JIT is called compiler when it is an Interpreter?
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?
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.
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.
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
Thank you Joe…Cool exp
Hi Joe,
Excellent explanation that is very important for every Java developer.
Hi Joe,
U r doing gr8 job. This is very nice explanation.
Keep it up.
Hi Joe,
Superv explanation. I got clear cut idea with your explanation..
Hi Joe,
Simple explanation but worthy. Thank you.
Good explanation
Thank You
Both JD Kand JVM are platform dependent
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?
Hi JOE,
Coul youu please expalin exactly how jvm is internally working?
[…] 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 […]
Nice work!!!
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?
Hi Amit,
JIT is not an interpreter. Newer JVM comes with JIT rather than interpreter. Interpreter is a old concept.
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.
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 …)
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. :)
Thanks Joe for the brief explanation
Joe ..keep up the good work ! I prefer javapapers over many :)
jre is platform dependent in java…………..
by jre your program made avliable for all os.sp java is platform independent.
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?
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 :-)
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.
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
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:—
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.
u can set the class path