JVM, JDK & JRE

JVM-Java Virtual Machine JVM is responsible for converting bytecode to machine-specific code(binary) and is necessary in both JDK and JRE. It is platform-dependent and performs many functions, including memory management and security. JDK-Java Development Kit JDK contains all the tools that are required to compile, debug, and run a program developed using the Java platform. JRE-Java Runtime Environment JRE, is a set of software tools responsible for execution of the Java program or application on your system. Java has two levels of translations. After writing a program it has to be converted into binary. (computer understandable language 0s and 1s) For example, we write a code called first. In other programming languages like C or C++ it is directly converted into binary. But in java it is converted into .class file also known as byte code which is an intermediary file and then into binary. First.java(our code) --> First.class (byte code) --> Binary code. Why? For providing high performance. While changing into class file it checks for errors. JDK contains compiler which checks for errors. When a code is error-free it gets converted into .class file. The time taken for this process is called compilation time. JRE contains JVM which receives the .class file(byte code) and according to the Operating system present it converts the byte code into binary. The time taken for this process is called run time. Let's understand the difference between compiler and interpreter. A compiler translates source code into machine code before execution, while an interpreter translates and executes code line by line. An Interpreter takes single lines of a code. Compiler is faster than interpreter. To explain this simply, compiler is a whole translator while intnterpreter is a line by line translator.

Apr 15, 2025 - 13:51
 0
JVM, JDK & JRE

JVM-Java Virtual Machine
JVM is responsible for converting bytecode to machine-specific code(binary) and is necessary in both JDK and JRE. It is platform-dependent and performs many functions, including memory management and security.

JDK-Java Development Kit
JDK contains all the tools that are required to compile, debug, and run a program developed using the Java platform.

JRE-Java Runtime Environment
JRE, is a set of software tools responsible for execution of the Java program or application on your system.

Java has two levels of translations.
After writing a program it has to be converted into binary. (computer understandable language 0s and 1s)
For example, we write a code called first.
In other programming languages like C or C++ it is directly converted into binary. But in java it is converted into .class file also known as byte code which is an intermediary file and then into binary.

First.java(our code) --> First.class (byte code) --> Binary code.

Why?
For providing high performance.
While changing into class file it checks for errors.

JDK contains compiler which checks for errors. When a code is error-free it gets converted into .class file. The time taken for this process is called compilation time.

JRE contains JVM which receives the .class file(byte code) and according to the Operating system present it converts the byte code into binary. The time taken for this process is called run time.

Let's understand the difference between compiler and interpreter.
A compiler translates source code into machine code before execution, while an interpreter translates and executes code line by line.
An Interpreter takes single lines of a code.
Compiler is faster than interpreter.

To explain this simply, compiler is a whole translator while intnterpreter is a line by line translator.