Skip to main content

Differences between JDK, JRE and JVM

What is JDK?

Java development kit (JDK) is a cross-platformed software development environment that provides the required tools for developing, testing, and running software applications written in the Java programming language.

It consists of the Java Runtime Environment (JRE), an interpreter/loader (Java), a compiler (javac), an archiver (jar), a document generator (Javadoc), and other tools.

In general, the JDK is an implementation of one of the three Java Platforms, i.e., Standard Edition (Java SE), Java Enterprise Edition (Java EE) and Micro Edition (Java ME).

Some of the most popular JDKs are - Oracle JDK, OpenJDK, Azul Systems Zing, IBM J9 JDK and Amazon Corretto.

What is JRE?

The Java Runtime Environment (JRE), is a software layer that runs on top of a computer's operating system and provides the resources that a specific Java program needs to run.

The JRE is one of the interrelated components in the Java Development Kit (JDK) and consists of libraries, tools, a separate JVM, and other resources.

Java source code is compiled and converted to Java bytecode.

In order to run this bytecode on any platform, the appropriate JRE should be installed on that platform (OS).

In general, a JRE includes components like - JDBC, JNDI, Interface Definition Language (IDL), RMI, Scripting and other integration libraries.

What is JVM?

The Java Virtual Machine (JVM) is a engine that provides a runtime environment to drive Java code or applications.

It is a part of the JRE and is the one that actually calls the main method present in a Java program.

It converts Java bytecode into machine language.


A program (code) can be developed on one system and run on any other Java enabled system without any adjustment. This is possible because of the JVM(Java Virtual Machine).

The ClassLoader performs three major functions - Loading, Linking, and Initialization. It reads the ".class" file, generate the corresponding binary data and save it in the method area.

The method area is memory where the class is loaded and, along with that, static variables and constants are defined.

Stack is the memory area where a method is loaded and its execution takes place. All local variables are also stored here.

The heap is the memory where objects and their related instance variables are created. This memory is common and is shared across multiple threads.

The PC register stores the address of the JVM instruction that is currently executing. In Java, each thread has its own PC register.

The JIT compiler compiles the bytecodes into native code for the platform on which it is running.


Comments

Popular posts from this blog

Deploying Spring Boot microservices on Kubernetes Cluster

This article guides you through the deployment of two Spring Boot microservices, namely "order-service" and "inventory-service," on Kubernetes using "MiniKube" . We will establish communication between them, with "order-service" making calls to an endpoint in "inventory-service." Additionally, we will configure "order-service" to be accessible from the local machine's browser . 1) Create Spring Boot microservices The Spring Boot microservices, "order-service" and "inventory-service," have been developed and can be found in this GitHub repository. If you are interested in learning more about creating Spring Boot REST microservices, please refer to this or this (Reactive) link. 2) Build Docker Images The Docker images for both "order-service" and "inventory-service" have already been generated and deployed on DockerHub, as shown below. codeburps/order-service cod...

Circuit Breaker Pattern with Resilience4J in a Spring Boot Application

Read Also: Spring Cloud Circuit Breaker + Resilience4j Resilience4j is a lightweight fault tolerance library that draws inspiration from Netflix Hystrix but is specifically crafted for functional programming. The library offers higher-order functions, known as decorators , designed to augment any functional interface, lambda expression, or method reference with features such as Circuit Breaker, Rate Limiter, Retry, or Bulkhead . These functionalities can be seamlessly integrated within a project, class, or even applied to a single method. It's possible to layer multiple decorators on any functional interface, lambda expression, or method reference, allowing for versatile and customizable fault tolerance. While numerous annotation-based implementations exist online, this article focuses solely on the reactive approach using router predicates and router functions . How Circuit Breaker Pattern works? In general, a circuit breaker functions as an automatic electrical s...

How to create a basic Spring 6 project using Maven

Below is a step-by-step guide to creating a basic Spring project using Maven. 1) Create a Maven Project Use the following Maven command to create a new Maven project. mvn archetype:generate -DgroupId=com.tb -DartifactId=spring-demo -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false 2) Import in IntelliJ IDEA If you haven't already, open IntelliJ IDEA on your system. Go to "File" > "New" > "Project from Existing Sources..." . In the file dialog, navigate to the directory where your Maven project is located. Select the pom.xml file within the project directory and click "Open." 3) Update pom.xml In total, the application requires the below-mentioned dependencies: 4) Create Spring Configuration Create a Java configuration class that uses annotations to define your Spring beans and their dependencies. This class should be annotated with @Configuration . 5) Create the Main Application C...