What is JRE (Java Runtime Environment) in Java

We know from the previous tutorial that the three most basic components of Java platform are Java Virtual Machine (JVM), Java Runtime Environment (JRE), and Java Development Kit (JDK).

The Java Runtime Environment (JRE) is a software environment in which Java program executes. It is a core component of the Java platform that provides all the necessary components required for executing Java applications on any system, regardless of operating system and underlying hardware. In simple terms, the JRE allows a computer system to run Java programs.

Java Runtime Environment (JRE) is a part of the Java Development Kit (JDK). It provides the runtime environment required to execute compiled Java bytecode.

JRE does not include development tools such as the Java compiler, so it cannot be used to develop Java applications. From Java 11 onward, JRE is no longer distributed as a standalone package and is bundled within the JDK.

Why Do We Need JRE in Java?


When you write a Java program and compile it using the Java compiler (javac), the source code is converted into bytecode. This bytecode is not understood directly by the operating system. To overcome this limitation, the Java Runtime Environment (JRE) provides the required runtime environment to load, verify, and execute Java bytecode securely.

Without JRE:

  • Java programs cannot run.
  • The JVM cannot execute bytecode.
  • Core Java libraries will not be available.

The Java Runtime Environment (JRE) is a runtime software environment that contains the Java Virtual Machine (JVM) and essential core Java class libraries required to run Java programs on any operating system.

If your computer system already has an up-to-date Java Development Kit (JDK) installed, you do not need to install anything again. The JDK includes the JRE, which provides the runtime support required to run Java programs, including those executed within Eclipse or other Java IDEs.

Components of Java Runtime Environment (JRE)


The Java Runtime Environment (JRE) consists of the following main components:

  • Java Virtual Machine (JVM)
  • Class Loader Subsystem
  • Bytecode Verifier
  • Execution Engine
    • Interpreter
    • Just-In-Time (JIT) compiler
  • Garbage Collector
  • Runtime Data Areas
    • Heap
    • Stack
    • Method Area
    • PC Register
    • Native Method Stack
  • Core Java Class Libraries (Java API)
  • Java Native Interface (JNI) & Native Libraries

Look at the below diagram to understand the components of JRE.

Complete Diagram of Java Runtime Environment (JRE) in modern Java.

Let’s understand a brief description of each component of JRE.

1. Java Virtual Machine (JVM)

The Java Virtual Machine is the core component of the JRE and is often called the “heart of JRE”. It performs the following operations for execution of the program:

  • Loads Java bytecode into memory.
  • Verifies bytecode to ensure security and correctness.
  • Converts bytecode into native machine instructions using the interpreter and Just-In-Time (JIT) compiler.
  • Provides a runtime environment for executing the program.

Each operating system has its own JVM implementation, which enables the most popular Java feature: “Write Once, Run Anywhere“.


2. Class Loader Subsystem

When you write a Java program and execute it, the Java Class Loader loads the required .class files into memory before execution. The class loader reads the compiled bytecode from the disk or from a network location and makes it available to the JVM.

After loading a class, the bytecode is passed to the bytecode verifier, which checks it for security and correctness before execution. In modern Java (Java 9 and later versions), the Class Loader subsystem consists of the following three main class loaders:

  • Bootstrap Class Loader
  • Platform Class Loader
  • Application (System) Class Loader

a) Bootstrap Class Loader

In Java’s module system introduced in Java 9, the bootstrap class loader is responsible for loading essential core Java classes from the java.base module. This module contains the fundamental packages required by every Java application and is loaded automatically at runtime.

The bootstrap class loader loads classes from packages such as:

  • java.lang – fundamental classes like Object, String, and System
  • java.util – utility classes and the collections framework
  • java.io – input and output operations

b) Platform Class Loader

In Java 9 and later releases, the platform class loader replaces the older extension class loader. The platform class loader loads platform modules from the Java Platform Module System (JPMS) introduced in Java 9. It comprises Java SE Platform APIs and other JDK-specific modules, such as:

  • java.sql
  • java.xml
  • java.desktop

The platform class loader does not load application modules or user-defined classes.

c) Application (System) Class Loader

The application (system) class loader loads application classes and user-defined classes from the classpath or the module path. These paths are specified using environment variables or command-line options such as -cp, –class-path, or –module-path when the Java application is launched.

These flags and variables instruct the JVM where to locate the required .class files and application resources.


3. Bytecode Verifier

The bytecode verifier verifies that Java bytecode is valid and complies without breaching any of Java’s security rules. It gives special attention to checking the types of all the variables and expressions in the code.

Bytecode verifier ensures that the code does not perform unauthorized memory access or illegal operations. Once the bytecode is successfully verified, it is transferred to JVM for execution by the interpreter and the Just-In-Time (JIT) compiler.

In modern Java (Java 9 and later versions), bytecode verification is enabled for all code by default. This is because it is a critical part of Java’s security model.

Disabling bytecode verification is strongly discouraged. Only use it for specialized testing purposes because it can compromise application security and stability.


4. Execution Engine

The main function of execution engine is to execute the verified bytecode and improve runtime efficiency. It uses mainly two components:

  • Interpreter – Executes bytecode line by line.
  • Just-In-Time (JIT) Compiler – Converts frequently executed bytecode into native machine code to enhance performance.

5. Garbage Collector

The garbage collector (GC) is a component of Java platform that automatically frees up heap memory by destroying unused objects that are no longer accessible in the program. It automatically runs in the background.

In modern Java versions, the garbage collector may use multiple threads. It can run concurrently or in parallel with application threads, depending on the garbage collection algorithm in use.


6. Runtime Data Areas

The runtime data areas are are specific, organized memory areas in the JVM that store program data during the execution of the program. These areas include:

  • Heap – Stores objects and class instances.
  • Stack – Stores method calls and local variables.
  • Method Area – Stores class metadata and static variables.
  • PC Register – Tracks current executing instruction.
  • Native Method Stack – Supports native code execution.

7. Java Class Libraries (Java API)

Java Application Programming Interface (API) is a very large collection of prepackaged, ready-made software components that provides the core functionality of the Java platform.

In simple words, Java API is a large collection of already defined classes, interfaces, and methods in the form of Java packages. It provides many useful features, such as

  • Graphical User Interface (GUI)
  • Date and Time
  • Calendar
  • Collections
  • Networking
  • Input and Output (I/O) operations
  • Multithreading
  • Security
  • Cryptography

Java API is grouped into libraries of related classes and interfaces along with their fields, constructors, and methods. These libraries are provided in the form of packages. They are used automatically by JVM in executing Java programs.

Popular Libraries and Their Functionality from Java API

Some popular libraries and their functionality from the Java API, in short, are:

a) Java.lang

  • This is a package that provides fundamental classes to design and run Java programs.
  • The Java.lang package is dynamically imported (i.e. loaded) into every Java program, meaning you do not need to import explicitly.
  • The most commonly used classes from Java.lang package are:
    • String, StringBuffer, StringBuilder
    • System, Math
    • Wrapper classes like Integer, Float, Double

b) Java.io

  • This package supports Input/Output operations through the file system, keyboard, network streams, etc.
  • The java.io package contains several classes to perform input and output operations.
  • The most commonly used classes from java.io package are:
    • File class
    • InputStreams
    • OutputStreams
    • Readers
    • Writers
    • RandomAccessFile

c) java.util

  • The java.util package provides the utility classes general-purpose programming.
  • This package provides legacy collection classes, event model, collections framework, date and time capabilities, and other utility classes such as string tokenizer.

d) Java.math

  • This package provides classes for high-precision mathematical calculations.
  • The common classes include:
    • BigInteger
      BigDecimal

e) java.security

  • This package provides classes and interfaces for security-related functions.
  • The java.security package supports:
    • Authentication
    • Authorization
    • Encryption
    • Digital signatures
    • Secure random number generation

f) java.awt

  • The java.awt package supports creating graphical user interface (GUI), painting graphics, and images.

g) java.sql

  • The java.sql package provides APIs to access and manipulate relational databases using SQL.
  • This package supports:
    • Database connections
    • Executing SQL queries
    • Processing result sets

h) java.beans

  • It supports the creation and use of JavaBeans components.

i) java.net

  • The java.net package provides classes that are used for implementing networking in Java programs.

j) javax.imageio

  • This package supports image input and output operations.
  • Used for reading and writing image formats like:
    • JPEG
    • PNG
    • BMP

These predefined Java API provide a tremendous amount of core functionality to a programmer. A programmer should be aware of these Java APIs. He should know how to use these them effectively.

The packages listed above are examples of some important libraries from the Java API. These libraries will be discussed in more detail in further tutorials.

A complete and up-to-date list of all Java API classes can be found in the official Oracle Java documentation for the latest Java versions.


8. Java Native Interface (JNI) and Native Libraries

  • The JNI and native libraries allows Java program to interact with native code typically written in C/C++.
  • Native libraries enable Java applications to call non-Java code through JNI framework.

Advantages of JRE in Java


Following are the advantages of JRE in Java:

  • Provides platform-independent execution of Java applications.
  • Offers a secure runtime environment for executing bytecode.
  • Handles automatic memory management.
  • Includes built-in garbage collection.
  • Provides access to robust standard Java libraries.
  • Improves performance using the Just-In-Time (JIT) compiler.

Limitations of JRE in Java


In addition to these advantages, there are the following limitations of JRE in Java:

  • Cannot compile Java source code (Java programs).
  • Does not include development tools such as javac, javadoc, or jdb.
  • Not available as a standalone package in latest Java versions (Java 11 and onwards).

Conclusion

The Java Runtime Environment (JRE) plays a vital role in executing Java programs by providing the JVM and essential core class libraries. Although modern Java versions does not distribute JRE separately, its functionality remains fundamental to Java’s execution model.

In today’s Java ecosystem:

  • JDK = Development + Runtime
  • JRE exists internally within the JDK (Java Development Kit).

Whether you are a beginner or an experienced Java developer, it is essential to understand the role of the JRE in the Java ecosystem.
We hope this tutorial has covered all the basics concepts related to Java Runtime Environment and its main components.

In the next tutorial, you will learn about the Java Virtual Machine (JVM). If you find anything incorrect in this tutorial, please inform our team via email. Your feedback is valuable to us.

DEEPAK GUPTA

DEEPAK GUPTA

Deepak Gupta is the Founder of Scientech Easy, a Full Stack Developer, and a passionate coding educator with 8+ years of professional experience in Java, Python, web development, and core computer science subjects. With strong expertise in full-stack development, he provides hands-on training in programming languages and in-demand technologies at the Scientech Easy Institute, Dhanbad.

He regularly publishes in-depth tutorials, practical coding examples, and high-quality learning resources for both beginners and working professionals. Every article is carefully researched, technically reviewed, and regularly updated to ensure accuracy, clarity, and real-world relevance, helping learners build job-ready skills with confidence.