If you are a Java programmer it’s very much important for you
to have a better understanding of its Environment and basic concepts. So the
very first thing which you should be knowing is, what is a JRE and JDK. While
installing Java, you have to install these to make your application functional.
But mostly people are not clear what the difference between these two is. So let’s
discusses the major differences between JRE and JDK.
JRE(Java Runtime environment)
JDK(Java Development Kit)
It is an implementation of the “Java Virtual
Machine” which actually executes Java programs.
It is a bundle of software that you can use to
develop Java based applications.
Java Runtime Environment is a plug-in needed for
running java programs. It is used to provide runtime environment.
Java Development Kit is needed for developing java
It includes the JVM, Core libraries, browser plugins
and other additional components to run applications and applets written in
It includes the JRE, set of API classes, Java
compiler (javac in its bin directory), tools (like JavaDoc, and Java
Debugger) Webstart and additional files needed to write Java applets and
The JRE is smaller than the JDK so it needs less
The JDK needs more Disk space as it contains the JRE
along with various development tools.
So, the conclusion is, when you only want to run Java
programs on your browser or computer you will only install JRE. It's all you
need. But, if you are planning to do some Java programming, you will also need
JDK. Sometimes, even though you are not planning to do any Java Development on
a computer, you still need the JDK installed. For example, if you are deploying
a WebApp with JSP, you are technically just running Java Programs inside the
application server and because application server will convert JSP into
Servlets and use JDK to compile the servlets, you need JDK.
In mathematical language we can say that, JDK is a superset
of JRE, and contains everything that is in JRE, plus tools such as the
compilers and debuggers necessary for developing applets and applications. JRE
provides the libraries, the Java Virtual Machine (JVM), and other components to
run applets and applications written in the Java programming language.
Typically, each JDK contains one (or more) JRE's along with the various
development tools like the Java source compilers, bundling and deployment
tools, debuggers, development libraries, etc.
the next very big question is, that if we have a JDK, do we still need to have
The answer is that, you don’t need to install JRE then
because JDK usually consists of both development and run-time environments in
it. Installing JDK will automatically install JRE.
So if you want to compile a program, i.e. javac
<filename.java> you need to have JDK which already have JRE in it. But to
do java <filename> you need only JRE, which is within JDK. Thus having
latest JDK installed into your system, you don’t need JRE separately. So it
depends on you what you want to do, whether just want to run java programs
(then you only need JRE) or want to develop then also (then you need JDK).