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)