What is JDK, JRE and JVM in Java?

Prem Parmar
3 min readJul 31, 2022

Everyone knows the acronym of these words:

  1. JDK — Java Development Kit
  2. JRE — Java Runtime Enviroment
  3. JVM — Java Virtual Machine

It is for those developers who don’t know, what they are used for. So today we’ll understand each of these component of JAVA.

If you are coding then JDK is the key component. To run any Java code, JRE is mandatory. JDK contains JRE, so you don’t need to worry about downloading it separately.

JDK contains JRE

If you belongs to Non programmer background then you only need to download JRE in your PC.

Java compiler converts JAVA code into Bytecode, which is not understandable by machine / PC. To convert that Bytecode into Machine-understandable code/instructions JVM is required. JVM is in the JRE so you don’t need to add it separately.

JRE contains JVM

Java is Platform independent

You have heard this line many times but It’s possible through JVM. When you install JAVA in Mac, Linux or Windows, Every platform has different JDK, JRE, & JVM.

Java code is compiled and “bytecode” is generated in any of the platform is same so that you can run that bytecode using JRE/JVM in any platform (linux, mac, windows).

Let us deep dive into the Each component:

JDK ( Java Developement Kit )

  • If you switch to bin folder of JDK, there is javac application, known as Java compiler, used to convert .java file to .class file. To convert Java code into ByteCode.

bin => binary files (contains executable codes for your library)

  • There are many more application like this : javadoc to convert documentation in html file.
  • Above SS contains simple JAVA code, Its ByteCode and command which invokes Java compiler.

JRE ( Java Runtime Environment )

  • As its name suggests Runtime Environment, which means provides environment to run the code.
  • Class file loading, ByteCode verifying, Interpreting is the responsibilities of JRE.
  • Three types of classloaders* : bootstrap, extensions, system

( * I’ll make blog of classloaders, in which contains explanation of all the classloaders)

JVM ( Java Virtual Machine )

  • JVM contains Heap, which stores objects, arrays and instance variables. Heap memory is accessed by multiple threads.
  • JVM contains Execution Enginer, comprises Interpreter, JIT compiler & Garbage Collector.
  • Interpreter — Convert “bytecode” into “machinecode”
  • For the same method conversion of bytecode to machinecode, It takes time. So it’s lit bit slow. To overcome this problem, JIT is introduced. JIT converts ByteCode into MachineCode at runtime.
  • Garbage collector is used to destroy unused objects in heap memory.

That’s it for today. If you have any doubt or query, Please feel free to ask questions in comment section.

--

--

Prem Parmar

Software Engineer, having 3 years of experience in Ecommerce / HCM domain Product based company.