Java – Difference between JDK, JRE and JVM

Understanding the difference between JDK, JRE and JVM is important in Java. We are having brief overview of JVM here.

Firstly, let’s see the basic differences between the JDK, JRE and JVM.


What is JVM?

JVM (Java Virtual Machine) is an abstract machine that enables your computer to run a Java program.

When you run the Java program, Java compiler first compiles your Java code to bytecode. Then, the JVM translates bytecode into native machine code (set of instructions that a computer’s CPU executes directly).

Java is a platform-independent language. It’s because when you write Java code, it’s ultimately written for JVM but not your physical machine (computer). Since, JVM ​executes the Java bytecode which is platform independent, Java is platform-independent.

How Java program works?


What is JRE?

JRE (Java Realtime Environment) is a software package that provides Java class libraries along with Java Virtual Machine (JVM), and other components to run applications written in Java programming. JRE is the superset of JVM.

JRE contains JVM and other Java class libraries.

 


What is JDK?

JDK (Java Development Kit) is a software development kit to develop applications in Java. When you download JDK, JRE is also downloaded, and don’t need to download it separately. In addition to JRE, JDK also contains number of development tools (compilers, JavaDoc, Java Debugger etc).

JDK contains JRE and other tools to develop Java applications.


Here’s the relationship between JVM, JRE, and JDK. As you can see that JDK is a superset of JRE.

Basically speaking when you just need to run Java Program you just need to install JRE but when you want to develop Java Program you need to install JDK.

JVM, JRE, JDK

Leave a Reply

Your email address will not be published. Required fields are marked *