Monday, 25 April 2016

JDK vs. JRE vs. JVM


JDK
JDK (Java Development Kit) is a set of a Java compiler, a Java interpreter, Applet viewer, developer tools, Java API libraries, documentation which can be used by Java developers to develop Java-based applications.
Compiler converts java code into byte code. Java application launcher opens a JRE, loads the class, and invokes its main method.

JDK is mainly targeted for java development.
JDK includes JRE as as subset. JDK contains more then one JRE and developmental sub program like debugger, libraries etc.


JRE
JRE (Java Runtime Environment) is a minimum set that includes a Java interpreter, Java API libraries, Java browser plug-in, which make up the minimum environment to execute Java-based applications.
It includes the JVM, as the JRE provides some standard libraries and the JVM which can be used to execute a Java program.
JRE is targeted for execution of Java files.

JRE contains JVM, class libraries, and other supporting files.
It does not contain any development tools such as compiler, debugger, etc. 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.
i.e. JRE = JVM + Java Packages Classes(like util, math, lang, awt,swing etc) + runtime libraries.


JVM
JVM (Java Virtual Machine) is the core of the Java platform and is a part of both the JDK and JRE that translates Java bytecodes and executes them as native code on the client machine.
JVM loads the appropriate class files for executing a Java Program, and then executes it.

JVM provides a platform-independent way of executing code; programmers can concentrate on writing software, without having to be concerned with how or where it will run.
JVM interprets the byte code into the machine code depending upon the underlying operating system and hardware combination. It is responsible for all the things like garbage collection, array bounds checking, etc.
JVM is platform dependent.

The JVM is called "virtual" because it provides a machine interface that does not depend on the underlying operating system and machine hardware architecture. This independence from hardware and operating system is a cornerstone of the write-once run-anywhere value of Java programs.


No comments:

Post a Comment

Note: only a member of this blog may post a comment.