Wednesday, June 3, 2015

Difference between JRE and JDK

Some people are confused about the functionality of JRE and JDK. Many times I am confused about JRE and JDK when I install Java. So here are a few points about JRE and JDK.

What is JRE?
 
The Java virtual machine is used to compile the Java program which converts source code to byte code (a readable form of machine language). This byte code varies from one platform to platform.
Here JRE is used as a interpreter of byte code into machine code. So JRE is a interpreter for the Java program.
Now we can see what JDK is
JDK contains software development tools which are used to compile and run the Java program.
Both JDK and JRE contains the JVM.
JRE contains the runtime environment such as JVM and other Java classes (AWT, SWING), but does not contain any development tools such as a compiler or a debugger.
In a previous article, Mr Akshaya Bhatia, wrote about the basic tools of JDK. Please refer to this article since it has more details which are not included here.

Summary
 
The Java Virtual Machine's (JVM) function is to load the appropriate class files for executing a Java Program, and then to execute it.
The Java Runtime Environment (JRE) includes the JVM, as the JRE provides some standard libraries and the JVM which can be used to execute a Java program.
The Java Developers Kit (JDK) also includes the JVM, standard class libraries, and several other tools that a developer needs in order to create a Java program.

No comments: