What is Java Runtime Environment (JRE)?

Posted in /  

What is Java Runtime Environment (JRE)?
vinaykhatri

Vinay Khatri
Last updated on August 14, 2026

    Java is one of the popular programming languages of 2022. It is a platform-independent programming language. This means the same Java code can be compiled and executed on any system without making any changes in the source. However, there is a catch to it. To run and execute Java code, we require some tools such as Java Virtual Machine (JVM), Java Runtime Environment (JRE), and Java Development Kit (JDK).

    All these three tools are platform-dependent tools. Using these three tools, we can create a Java program and execute it. So, for a Java developer, it's necessary to have these installed before compiling and executing any Java code or byte code. Among the trio, JDK and JRE are software, whereas JVM is a concept. Thus, we cannot install JVM separately.

    Note : JDK is a combination of JRE and JVM. Therefore, when we install or download JDK, it includes a compatible version of JRE, which contains the default JVM.

    What is a Runtime Environment?

    A runtime environment is a software that provides an environment to execute and run specific code. The runtime environment loads all the necessary files and makes sure that the program gets enough memory and other resources from the system while it runs.

    Programming languages like C++ and C do not have any specific runtime environment. They depend on the operating system for all the memory and resource allocation. However, programming languages like Java use a runtime environment.

    What is Java Runtime Environment (JRE)?

    Most high-level programming languages depend on the OS for a runtime environment, but this is not the case in Java. When we discuss the different layers in systems, which include hardware and software, the runtime environment resides in the computer's operating system. Now, let’s talk about Java Runtime Environment (JRE).

    JRE is a software that is a part of the Java Development Kit and executes the compiled code of Java source code. JRE makes sure that Java code runs on every system without making any changes in the source code. JRE provides many features, and memory management is one of the important ones.

    In this, users do not have to control memory allocation and deallocation of the software. All is done by Java Runtime Environment. In a nutshell, Java Runtime Environment is a Java-specific software that is designed to run Java programs. It contains many class libraries, a java class loader, and a Java Virtual Machine (JVM) . Classloader helps to connect the core Java class libraries with currently loading classes.

    Java virtual machine is a virtual machine that helps to provide necessary resources to the Java application so that the program can run. JRE combines all the resources and concepts that are required to run the Java byte code.

    Note: JDK = JRE + JVM (Software) JRE = JVM + Class loaders (Software) JVM = Java Interpreter + Threading + Garbage Collection (Virtual Machine)

    Working of JRE

    The Java Runtime Environment (JRE) provides all the components required to run a Java application on a computer. When a Java program is compiled, the Java compiler converts the source code (.java file) into bytecode stored in a .class file. This bytecode is platform-independent and can be executed by a compatible Java runtime.

    When you run the Java application, the JVM inside the runtime loads and verifies the bytecode before executing it. The JVM converts the bytecode into machine-level instructions that the underlying operating system and hardware can understand. The JRE also provides Java class libraries and other runtime resources required by the application.

    1. Writing Java Source Code

    The process begins when a developer writes a Java program using a text editor or an Integrated Development Environment (IDE). The source code is saved with the .java extension and contains instructions written in the Java programming language.

    For example:

    class Demo {

    public static void main(String[] args) {

    System.out.println("Hello, World!");

    }

    }

    2. Compilation of Source Code

    The Java source code cannot be directly executed by the computer. It is first compiled using the Java compiler (javac). The compiler checks the code for syntax errors and converts the source code into bytecode. The resulting bytecode is stored in a .class file.

    Demo.java, Java Compiler, Demo.class

    3. Loading the Bytecode

    When the Java application is executed, the Class Loader component of the JVM loads the required .class files into memory. It identifies and loads the classes needed by the application during execution. The class loader can load classes from different sources, such as the local file system or other configured locations.

    4. Bytecode Verification

    After loading the bytecode, the JVM verifies it to ensure that it follows Java's safety and structural rules. The Bytecode Verifier checks the code for potential issues before execution. This verification helps prevent invalid or unsafe bytecode from being executed and contributes to Java's security model.

    5. Linking and Initialization

    The JVM links the loaded classes with the runtime environment. This process involves tasks such as preparing memory for static fields and resolving references between classes when required. The JVM then initializes the classes before they are used by the application.

    6. Bytecode Execution

    Once the bytecode has been loaded and verified, the JVM executes it. The Execution Engine interprets the bytecode or uses Just-In-Time (JIT) compilation to convert frequently executed bytecode into native machine instructions.

    This allows the Java application to run on the underlying operating system and hardware.

    7. Runtime Support and Memory Management

    During execution, the JRE provides access to Java's standard class libraries and runtime services. The JVM also manages memory using areas such as the heap and stack.

    Java's Garbage Collector automatically identifies and removes objects that are no longer needed, helping manage memory without requiring developers to manually free it.

    JRE Architecture

    The architecture of the Java Runtime Environment consists primarily of the JVM, Java class libraries, and other supporting runtime components. These components work together to provide an environment for executing Java applications.

    • Java Application: This is the Java program that the user wants to execute.
    • Java Class Libraries: These libraries provide predefined classes and methods that applications can use for tasks such as input/output, networking, collections, and file handling.
    • Java Virtual Machine (JVM): The JVM loads, verifies, and executes Java bytecode. It also manages memory and provides runtime services required by Java applications.
    • Operating System: The JVM interacts with the underlying operating system to access system resources and hardware.

    Working of JRE with JVM

    Java virtual machine is responsible for executing Java programs. JRE consists of JVM along with some libraries. It is software that takes the Java code and combines it with the required libraries so the Java Virtual Machine can execute that code. This means JVM executes the code with the help of an interpreter. If we look at the complete working Java framework of JRE:

    • It grabs the compiled code from memory,
    • Loads that compiled Java code into the main memory, and
    • Connect it with the appropriate Java class libraries so that the Java Virtual Machine can finally execute it.

    Installing JRE

    When we install Java or Java Standard Edition , we do not have to install JRE separately. Java SE comes with a complete package that consists of the JDK with an appropriate and compatible version of JRE. The Java code becomes platform-independent only if that system has a Java development kit with a compatible version of JRE.

    Conclusion

    JRE is a part of Java JDK, and it is software that our system must have if we want to run a Java application. While installing any edition of Java, whether it is Standard or Enterprise, they all contain a Java Runtime Environment with the proper Java Virtual Machine. JRE includes all the core Java class libraries, class loaders, and a Java Virtual Machine.

    People are also reading:

    FAQs


    JRE is a runtime environment for Java that enables Java programs to run correctly. It is an underlying technology that enables the communication between Java programs and the operating system.

    Yes, we need JRE to run Java programs. It is a software layer that runs on top of a system's operating system and provides resources, like class libraries, to run Java programs.

    No, Java and JRE are not the same. Java is a programming language, while JRE (Java Runtime Environment ) is a collection of software tools required to run Java programs.

    If you simply want to run Java programs and not develop Java applications, you can use JRE alone. However, if you want to develop a fully-functional Java application, you need o install JDK (Java Development Kit). JDK comes with JRE, and hence, you do not need to download JDK and JRE separately.

    JRE provides all essential class libraries and resources needed for the execution of Java programs. On the other hand, JVM (Java Virtual Machine), a subset of JRE, converts bytecode into machine language.