Why it is necessory to know this terms very well ..?
What you need to
run java program on your computer . JVM..??
NO.
JVM is not enough even only JRE is not enough.
You will need JDK [ Big Boss ] for it. But what are these terms lets know about JDK, JRE, JVM and JIT.
In this post we are going to explore following
things :
1. Why we need to understand this..? [As i mention above in intro .]
2. Flow Dig [ who
uses whom ]
3. JDK [shipped for free to us by Sun ]
4. JVM [ Real game changer ]
5. JRE [cares about device specific features ie, java runs on MS,
Mac, Linus ]
5. JIT [ speed up the process ]
5. JIT [ speed up the process ]
6. Summary.
[ Sticky notes]
Flow Dig :
JDK ( Java Development Kit ) :
JDK (Java Development Kit) it contains 2 things :
1. JRE ( To run the proggram ).
2. development tools
like Java libraries, Java compilers, debuggers,
bundling and deployment tools
and API’s.
JVM ( Java Virtual Machine ) :
- Converts bytecode (i.e. .class file) to 'system specific' code. Now, since system specific code, as the
- Name suggests is dependent on OS . JVM do this by implementing JRE.( implementing....?? read JRE you ‘ll get it).
JVM is platform dependent but it makes the
Java platform independent.
JRE ( Java Runtime Environment) :
- JRE is not part/subset of JVM.
- JRE is an implementation of JVM (e.g. Oracle, MySQL, DB2 etc. are implementations of a specification named RDBMS).
- What actually happens here is - when we compile a Java file, the compiler converts Java code in a byte-code. This byte-code is nothing but instructions which are understandable by an implementation of JVM (i.e. JRE)
Now the job of JRE ( if JDK tells him to do) is - to read byte-code, and convert it into another byte-code which is understandable by underlying OS.
- JRE is runtime interpreter as JVM implement (uses) JRE to convert (.class) byte code to OS specific machine readable code.
JIT ( Just in time Compiler ) :
- JIT is the part of the Java Virtual Machine (JVM) 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.
Summary :
- If you able to run successfully java program on your machine then you are using JRE.
- JDK is important if you want to develop and run code (as it contain JRE and Compiler with other libraries).
- JIT is just used to save run time.