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 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.


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 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.

3) 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.

Difference between JDK and JRE in Java Platform




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

2 comments:

  1. It is not about which is better, as each offers different benefits for the developer. The JRE will help in running downloaded Java programs on desktop computers. It will accept the same byte code and convert it to machine code and make it compatible for operating systems like Win 32, Win 64, Linux and Android. On the other hand, JDK offers useful tools to develop Java applications.

    ReplyDelete
  2. Java is a very easy to use language once u get a hold of it.... if anyone is a beginner in java then they should attend some interesting java focused conferences which gives a huge knowledge abt the language nd very interesting, easy tips nd tricks which are very useful... few of the famous java conferences are Javapolis (devox), JavaOne, and recently i received a mail from oracle regarding their JavaOne conference.. They have many interesting sessions lined up fr this year... you can take a look at their sessions related topics
    https://www.regpulse.com/javaone2013/register.php?pcode=737266&src=4003&Act=1

    I myself hoping to attend several sessions about Core Java Platform; JavaFX, Java Embedded, and Java Card and many more.

    ReplyDelete

Feel free to comment, ask questions if you have any doubt.