DEV Community

Dinesh G
Dinesh G

Posted on

JVM, JDK & JRE

JVM - (Java Virtual Machine).

Java Virtual Machine is the foundation of Java programming language and ensures the program's Java source code will be platform-agnostic. It's used to run Java bytecode. JVM is included in both JDK and JRE, and Java programs won't run without it.

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.

TheJVM is platform-dependent, meaning a specific JVM implementation exists for each operating system (e.g., Windows, macOS, Linux).

JDK - (Java Development Kit)

Java Development Kit is a software development environment that includes JRE and development tools. It's used to create Java applications and applets. JDK includes tools like a compiler, debugger, and documentation generator.

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

These development tools include the Java compiler (javac), debugger, Javadoc tool, and other utilities necessary for writing, compiling, and debugging Java programs.
The JDK is essential for Java developers who need to create and compile Java code.

JRE - (Java Runtime Environment)

Java Runtime Environment is a set of software tools that provides a runtime environment for running other software. It's used to run Java applications. JRE contains class libraries, supporting files, and the JVM.

The JRE is designed for users who only need to run Java applications and do not require development tools.

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.

In single line Example:

  • JVM: is the engine that executes Java bytecode, ensuring platform independence.

  • JRE: is the environment required to run Java applications, containing the JVM and necessary libraries.

  • JDK: is the complete toolkit for developing Java applications, encompassing the JRE and development tools

Top comments (0)