DEV Community

Kesavarthini
Kesavarthini

Posted on

Understanding JDK, JRE, JVM, and JIT in Java

When I started learning Java, I was confused by terms like JDK, JRE, JVM, and JIT.
They sounded similar, but each one has a different purpose.

In this blog, I’ll explain these concepts in a simple and beginner-friendly way.

🔹 What is JDK?

JDK (Java Development Kit) is used to write and develop Java programs.

It contains:
• JRE
• Compiler (javac)
• Debugger
• Development tools

👉 If you want to write and compile Java code, you must install JDK.

Example Java File:

Syntax.java
Enter fullscreen mode Exit fullscreen mode

If there is a mistake in code, then we will encounter a syntax error.

To compile Java code:

javac Syntax.java
Enter fullscreen mode Exit fullscreen mode

If compilation is successful, a new Syntax.class will be generated in the location where your Syntax.java file is located

🔹 What is JRE?

JRE (Java Runtime Environment) provides required environment to run Java applications.

It contains:
• JVM
• Core Java libraries
• Supporting files

👉 If you only want to run a Java program, JRE is enough.

🔹 What is JVM?

JVM (Java Virtual Machine) is the heart of Java.
• It executes Java bytecode
• It makes Java platform independent
• It converts bytecode into machine code

👉 Java program → compiled into bytecode → JVM runs it

🔹 What is JIT?

JIT (Just-In-Time Compiler) is part of JVM.
• Improves performance
• Converts frequently used bytecode into native machine code
• Makes Java programs run faster over time

👉 JIT helps Java achieve better speed and efficiency.

Top comments (0)