Friday, February 22, 2013
Difference between JDK and JRE in Java Platform
Java Platform offers JRE and JDK to run Java programs. JRE stands for Java runtime environment and JDK stands for Java development kit. JRE is meant for normal users, who wants to run Java program in there computer. JRE is normally used to run Java programs downloaded over internet e.g. Java Applets and Java Desktop application built using AWT and Swing. Main difference between JRE and JDK, comes from the fact that they are different tools. JDK is created for Java programmers, and contains tools required for Java programming, e.g. javac for compiling Java source files to .class files. Without JDK, you can not create Java applications and programs. By the way JDK comes with it's own JRE, but when you run Java program using java command, the JRE which comes first in System PATH is used for execution. One of the important thing to know is that, you can not run Java program from your machine if you don't have either JRE or JDK. You can also consider JDK as super set, which also contains JRE. For a normal user, installing JDK is overkill. They needs JRE only and any browser will assist them for installing JRE, as browser plugin. By the way, beware with any security issue, while installing JRE. JRE releases sometimes has security flaws which can compromise your computer, that's the reason recently many browser has by default disabled Java. Any way, in next section we will see some more difference between JRE and JDK in Java.
In last post, we have seen Difference between JVM and JIT in Java and Now we will compare JDK and JRE. Here are some points, which is useful to differentiate JRE from JDK. Remember JRE, meant for Java Runtime Environment and JDK stands for Java Development Kit. If you go by there name, You can easily see what is difference in JDK and JRE.
1) Main difference between JRE and JDK is that, you can not compile Java program using JRE. Tools required for compiling Java source file to create class files, i.e. javac, comes with JDK installation.
2) As name suggest JRE is for running Java program and developed as browser plugin. In order to run any Java program from browser like Internet Explore, Mozilla Firefox or Google Chrome, you need JRE to be installed in your machine and should be enable on your browser as well.
3) JRE is meant for users, while JDK is meant for programmers. Since Java was sensation during Internet boom of 1990s, where Applet was most popular for its rich offering over internet, JRE was required to run those applet on users machines.
That's all on difference between JRE and JDK in Java platform. As I said, only JRE is enough to run Java program and JDK is required only if you want to do programming in Java platform. For normal internet users JRE is enough, but beware of security hols comes now and then with different Java releases.
Related Java article from Java67 Blog