Difference between JDK and JRE in Java Platform (original) (raw)
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 their 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. The 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, like 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 its 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.
Difference between JRE vs 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.
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.
As the name suggests 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.
JRE is meant for users, while JDK is meant for programmers. Since Java was a sensation during the Internet boom of the 1990s, where Applet was most popular for its rich offering over the internet, JRE was required to run those applets on users machines.
That's all on the difference between JRE and JDK in the Java platform. As I said, only JRE is enough to run a Java program and JDK is required only if you want to do programming in the Java platform. For normal internet users, JRE is enough, but beware of security holes comes now and then with different Java releases.
Related Java article from Java67 Blog