Java Development Kit (JDK)
Java
Development Kit
contains tools needed to develop the Java programs, and JRE to
run the programs. The tools include compiler (javac.exe), Java application
launcher (java.exe), Applet viewer, etc… Compiler converts java code into byte code. Java application launcher opens a JRE, loads the class, and invokes its main method.
You need JDK, if at all you want to write your own programs, and to compile them. For running java programs, JRE is sufficient. JRE is targeted for execution of Java. JDK is mainly targeted for java development.
Java Runtime Environment (JRE)
Java
Runtime Environment contains JVM, class libraries (like util, math, lang, awt, swing
etc), and other supporting files.
Actually
JVM runs the program, and it uses the class libraries, and other supporting
files provided in JRE. If you want to run any java program, you need to
have JRE installed in the system.
Java Virtual Machine (JVM)
Java Virtual Machine executes the program and generates output. To execute any code, JVM utilizes different components.
The Stack
· Stack in JVM stores various method arguments as
well as the local variables of any method.
Method Area
This
is the area where byte codes reside. The program counter points to some byte in
the method area. It always keeps tracks of the current instruction which is
being executed (interpreted).
Garbage-collected Heap
The
Garbage-collected Heap is where the objects in Java programs are stored.
Whenever we allocate an object using new operator, the heap comes into picture
and memory is allocated from there
Remember
that the local object reference resides on Stack but the actual object resides
in Heap only. Also, arrays in Java are objects, hence they also resides in
Garbage-collected Heap.
Just In Time Compiler (JIT)
JIT is a module inside the JVM which helps in compiling
certain parts of byte code into the machine code for higher performance.
Note that only certain parts of byte code will be compiled to the machine code,
the other parts are usually interpreted and executed.
What is the use of bin and lib in JDK?
- Bin contains all tools such as javac, appletviewer, awt
tool, etc., whereas lib contains API and all packages.
This comment has been removed by the author.
ReplyDelete