February 28, 2024


Consider It Solved

What is the JRE? Introduction to the Java Runtime Environment

8 min read
Javaworld > JVM / JDK / JRE explainer series > Java Runtime Environment > monitoring + configuration

Alongside one another, the Java Enhancement Kit (JDK), the Java Virtual Machine (JVM), and the Java Runtime Environment (JRE) kind a impressive trifecta of Java and Jakarta EE platform elements for building and managing Java purposes. They all work together to enable developers construct and run Java programs. I’ve beforehand introduced the JDK and JVM. In this swift overview, you will understand about the JRE, which is the runtime atmosphere for Java.

Virtually speaking, a runtime surroundings is a piece of application that is built to run other software. As the runtime environment for Java, the JRE has the Java class libraries, the Java class loader, and the Java virtual device. In this method:

  • The course loader is accountable for effectively loading courses and connecting them with the main Java course libraries.
  • The JVM is responsible for making sure Java programs have the assets they will need to run and perform effectively in your gadget or cloud environment.
  • The JRE is mostly a container for these other parts, and is dependable for orchestrating their things to do.

We’ll dig a large amount further into how these elements work together in the dialogue that follows.

What is a runtime ecosystem?

A software program method needs to execute, and to do that, it demands an setting to operate in. In the past, most program employed the working process (OS) as the runtime surroundings. The program ran within whatsoever personal computer it was on and relied instantly on functioning procedure configurations for useful resource accessibility sources like memory, disk accessibility, and community access. The Java Runtime Ecosystem altered all that, at least for Java plans. In the circumstance of Java and other JVM-primarily based languages, the JRE generates an intermediary among the running method and the true software. The JRE hundreds class files and commences a virtual machine (the JVM) that assures there is entry to memory and other program assets in a constant form throughout quite a few functioning systems.

The Java Runtime Ecosystem

We can glimpse at application as a collection of levels that sit on top of the program hardware. Every layer delivers providers that will be used (and essential) by the layers over it. The Java Runtime Atmosphere spawns a JVM, which is a software package layer that runs on prime of a computer’s working method, delivering more providers certain to Java. Figure 1 illustrates this arrangement.

jre diagram IDG

Figure 1. The Java Runtime Ecosystem spawns a JVM.

The JRE smooths in excess of the range of functioning techniques, ensuring that Java packages can run on practically any running system without modification. It also delivers worth-extra solutions. Automated memory administration is a person of the JRE’s most essential companies, making certain that programmers never have to manually manage the allocation and reallocation of memory.

In brief, the JRE is a kind of meta-OS for Java, along with other JVM languages like Scala and Groovy. It is really a common case in point of abstraction, abstracting the underlying working program into a constant system for running Java programs.

How the JRE will work with the JVM

A Java digital machine is a working software process liable for executing stay Java systems. The JRE is the on-disk software package element that takes your compiled Java code (the code is compiled with the JDK), brings together it with the required libraries, and starts the JVM to execute it.

The JRE is made up of libraries and application that your Java courses will need to run. As an instance, the Java class loader is component of the JRE. This essential piece of application masses compiled Java code into memory and connects the code to the correct Java class libraries (a course of action recognized as linking).

In the layered look at I just described, the JVM is produced by the JRE. From a offer viewpoint, the JRE incorporates the JVM, as proven in Figure 2. The JVM is element of the JRE—it’s the energetic, functioning aspect that the JRE creates to host applications. The JRE requires static assets and turns them into a functioning JVM hosting the managing plan.

jw whatisjre fig1 IDG

Figure 2. A layered architectural see displays that the JRE has the JVM, class loader, and Java class libraries.

Installing and utilizing the JRE

Though there is a conceptual facet to the JRE, in real-globe practice it really is just program installed on a laptop or computer, whose function is to run your Java programs. As a developer, you will generally operate with the JDK and JVM, for the reason that these are the system components you use to produce and operate your Java packages. As a Java application consumer, you would be far more associated with the JRE, which lets you run people programs.

Java 9 restructured the Java system so that the JRE is now only offered as component of a JDK. You can supply a bundled JRE with your apps when you want to ship a shopper software, utilizing JLink. Such a bundle is made up of all the essential elements to run the method. For our applications, we’ll use a JRE within the JDK. You can down load the most up-to-date JDK for your procedure from Oracle’s Java SE site. Windows and macOS have automatic installers that will manage the information (like location the route). On Linux, a awesome possibility is to use SDKMan. In any event, you will want to have the JRE accessible from your command line so that you can use the java command.

Versions of the JRE

The Java Runtime Setting is current for each and every new edition of Java, and its model numbers align with the Java system versioning method, so for case in point JRE 1.19 runs Java 19.

Quite a few desktops operate a JRE developed for Java SE, which is equipped to run any Java software regardless of how it was produced. Most cellular gadgets arrive with a JRE for Java ME, which is pre-put in on the cell machine and is not out there for down load. Heading forward, apps bundled with their individual JRE by way of JLink will turn out to be the norm.

As soon as you have downloaded the JDK, you can interact with the contained JRE on the command-line by typing java -variation, which will convey to you what edition is set up. (On POSIX units, you can usually verify the mounted place with the command, which java.)

The JRE in devops

The JRE is not really obvious in the growth stage, where by it typically just operates your applications in the OS or IDE of your option. It performs a a little bit a lot more well known position in devops and devices administration since the JRE is utilised for monitoring and configuration.

Generally, the JRE supplies the “knobs” you would use to configure and manage the attributes of a Java application. Memory utilization is a key illustration, the bread and butter of programs administration. Although memory use is always critical, it’s very important in cloud configurations, and devops is a cloud-centered tactic to creating and operating software package. If you are working in a devops environment, or fascinated in branching out into devops, it can be a great strategy to comprehend how Java memory works and how it is really monitored in the JRE.

Java memory and the JRE

Java memory is composed of a few factors: the heap, stack and metaspace (which was previously known as permgen).

  • Metaspace is where Java keeps your program’s unchanging details like course definitions.
  • Heap place is wherever Java retains variable content material.
  • Stack space is exactly where Java shops function execution and variable references.

Java memory administration due to the fact Java 8

Right until Java 8, metaspace was recognized as permgen. Aside from getting a considerably cooler identify, metaspace is a important alter to how developers interact with Java’s memory area. Previously, you would use the command java -XX:MaxPermSize to watch the measurement of permgen place. From Java 8 forward, Java routinely boosts the sizing of the metaspace to accommodate your program’s meta-needs. Java 8 also launched a new flag, MaxMetaspaceSize, which you can use to restrict the metaspace size.

Configuring heap house

Heap place is the most dynamic element of the Java memory process. You can use the -Xms and -Xmx flags to tell Java how big to get started the heap, and how massive to enable it to turn out to be. Knowing how to tune these flags for certain software requirements is an vital aspect of memory administration in Java. The perfect is to make the heap significant more than enough to attain the most successful garbage assortment. That is, you want to let plenty of memory to enable the software run, but you do not want it to be any bigger than necessary.

Configuring stack room

Stack room is where purpose phone calls and variable references are queued. Stack area is the source of the next-most-notorious exception in Java programming: the StackOverflowError (the first is the NullPointerException). The stack overflow exception implies that you have run out of stack space mainly because as well a lot of it has been reserved. Commonly, you may get a stack overflow when a process or approaches phone each other in a round trend, thus devoting an at any time-expanding variety of operate phone calls into the stack.

You use the -Xss switch to configure the stack starting off sizing. The stack then grows dynamically according to the program’s requirements.

Java application monitoring

Although software monitoring is a purpose of the JVM, the JRE supplies configuration choices, which are the needed baseline for monitoring. A wide variety of tools are accessible for checking Java programs, from the classics (like the Unix command prime) to sophisticated remote monitoring answers like Oracle’s infrastructure checking.

In amongst these choices are visible profilers like VisualVM that allow for for inspecting a operating JVM. These applications allow tracking down hotspots and memory leaks, as effectively as watching total memory usage in your process.


The Java Runtime Atmosphere is the on-disk software that masses Java programs for the JVM to execute. A JRE is included by default when you download the JDK, and each JRE includes the main Java class libraries, a Java course loader, and a JVM. It’s beneficial to recognize how the JVM, JDK and JRE interact, specifically for operating in cloud and devops environments. In these environments, the JRE normally takes a more robust function in monitoring and configuration than it would in conventional Java software advancement.

This tale, “What is the JRE? Introduction to the Java Runtime Environment” was initially released by


Copyright © 2022 IDG Communications, Inc.

Leave a Reply

dsimpson6thomsoncooper.com | Newsphere by AF themes.