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...

Declarative REST Client in Spring Boot (Spring 6 HTTP Interface)

Feign , an early declarative REST client, was initially part of the Spring Cloud Netflix stack and later rebranded as Spring Cloud OpenFeign . Before its introduction, crafting HTTP calls using RestTemplate involved repetitive code for each service interaction. With Feign, developers could simply define an interface with method contracts mirroring the service's endpoints. Behind the scenes, proxy magic generated a fully functional HTTP client, eliminating the need for boilerplate code . HTTP Interface (Spring Framework 6) The recent release of Spring Framework 6 integrated this declarative REST client as a native part of the core web framework in the form of the HTTP Interface . All the necessary components reside in the spring-web module, which is a transitive dependency for either the spring-boot-starter-web or spring-boot-starter-webflux modules. Currently, the WebFlux dependency is essential due to the HttpServiceProxyFactory , responsible for client gener...