Difference between JDK, JRE, JVM

Adil Wadhwania
3 min readDec 5, 2022

What is JDK, JRE, JVM in java, difference between JDK, JRE, JVM.

We should understand JDK, JRE and JVM before starting to write code in java.

JVM (Java Virtual Machine) :-

JVM is a virtual machine that physically does not exists. Java virtual machine provides platform independent execution of java programs,

JVM converts Byte code into machine specific code and gives us the output of the java program

Java virtual machine is responsible to execute the program line by line.

JVM differs for each operating system, we have different JVM for mac OS , different JVM for windows and different for Linux also. JVM is platform dependent.

JRE(Java Runtime Environment) :-

JRE provides runtime environment to run java programs, it is the implementation of JVM.

JRE

JRE consists of JVM, set of java libraries and other files.

If you want to only run the java program in your machine then you need to install JRE, JRE is responsible to run the java program.

The rt.jar is runtime jar file that contains all the classes of Standard Java API.

We know JRE provides runtime environment for JVM to execute the program line by line, here the JVM uses this Standard java API(rt.jar) to execute the program.

JDK(Java Development Kit) :-

Java development kit is entire package or kit that is used to develop, compile, debug and run the java program.

JDK

Java Development Kit consists of two things :-

  1. Development tools(Used to develop java programs )
  • The development tools consist of debugger, compiler and Archiver.
  • Debugger is used to debug the program and see what will execute when you run the program line by line, what are the values of variables declared and check that whether we got expected output or not for an input. This would be helpful while we encounter an issue in our code.
  • Archiver is used to create jar in java that is a single file consist of all the compiled java class files and additional resources(configuration files).
  • Compiler is used to convert the source code into bytecode that is then executed by JVM with the help of JRE.

2. Runtime environment(JRE)

  • JRE consist of JVM and set of java libraries, JVM uses rt.jar and executes the program line by line

How Java program works ?

how java program works

First we write a java program in an IDE that we want to run, then that java code is compiled using the compiler (Compiler is present in JDK you will get that in your JDK folder/bin/javac.exe) and converted into byte code.

This byte code is the .class file created after compiling the code and the byte code is independent of the platform(it can run on windows, linux or mac) and this is reason why java is platform independent.

JVM converts this byte code into machine specific code and we get the output of the program we have written. JVM is platform dependent that means windows, mac and linux has different JVM.

Youtube video on Difference between JDK JRE and JVM :-

You can also check youtube video on this topic.

“Thank you for taking the time to read my blog! I hope you found the information and insights shared here helpful and interesting. If you enjoyed this article, be sure to follow my blog for more similar content. I’m always exploring new topics and sharing my thoughts and insights on a variety of subjects. I appreciate your support and look forward to connecting with you through my writing. Until next time!”

ADIL WADHWANIA :)

Topics :-

What is JDK, JRE and JVM, Difference between JDK, JRE and JVM, How java program works, Core java

--

--

Adil Wadhwania

Tech-savvy writer sharing insights on programming,current affairs,sports,great personalities, and new technologies. Follow for engaging and informative content.