What Is JRE?

JRE stands for Java Runtime Environment. It is the traditional runtime environment used to provide the components necessary to run Java applications. The JRE includes the JVM, Java class libraries, and supporting runtime components required for Java programs to execute.

The easiest way to understand JRE is to think of it as the environment in which a Java application runs. Developers use the JDK to create and compile Java programs, while the runtime environment provides what is needed to execute the compiled Java bytecode.

Why Is JRE Needed?

Java source code is first compiled into bytecode by the Java compiler.

Java Source Code
       ↓
      JDK
       ↓
    Compiler
       ↓
    Bytecode
       ↓
      JRE
       ↓
      JVM
       ↓
Program Execution

For example, when this program is compiled:

public class Hello {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}

The compiler creates a .class file containing Java bytecode. The Java runtime then provides the environment in which that bytecode can be executed.

What Does JRE Contain?

Traditionally, the JRE consists of the main components required to run Java applications.

JVM

The Java Virtual Machine (JVM) is the most important component of the runtime environment. It loads and executes Java bytecode.

The JVM also provides services such as memory management, garbage collection, class loading, and JIT compilation.

Java Class Libraries

Java provides a large collection of standard libraries that applications can use without implementing everything from scratch.

Examples include APIs for:

  • Strings
  • Collections
  • Input and output
  • Networking
  • File handling
  • Dates and times
  • Multithreading
  • Security

For example:

import java.util.ArrayList;

ArrayList<String> names = new ArrayList<>();
names.add("John");
names.add("David");

These standard APIs are an important part of the Java runtime platform.

Runtime Components

The Java runtime also includes supporting components required for loading classes, managing memory, handling resources, and executing Java applications.

Together, these components provide the environment required for a Java application to run.

JRE vs JDK

The main difference between JRE and JDK is their purpose.

JRE is traditionally intended for running Java applications, while JDK is intended for developing Java applications.

FeatureJREJDK
Full NameJava Runtime EnvironmentJava Development Kit
Main PurposeRun Java applicationsDevelop Java applications
JVMIncludedIncluded
Java LibrariesIncludedIncluded
Java Compiler (javac)Not traditionally includedIncluded
Development ToolsLimited runtime environmentExtensive development tools
Intended UserApplication user/runtimeJava developer

A simple way to remember this is:

JRE = Run Java applications

JDK = Develop Java applications

JRE vs JVM

JRE and JVM are also different concepts.

The JVM is the engine that executes Java bytecode, whereas the traditional JRE represents the broader runtime environment that includes the JVM and the libraries needed by Java applications.

JRE
 ├── JVM
 ├── Java Libraries
 └── Runtime Components

Therefore, the JVM is a component of the traditional JRE concept rather than being the same thing as the JRE.

JDK, JRE, and JVM Relationship

These three terms are often represented using the following relationship:

JDK
 └── Runtime Environment
      └── JVM

Traditionally, this was simplified as:

JDK → JRE → JVM

The JDK provides development tools, the JRE provides the traditional runtime environment, and the JVM executes Java bytecode.

Is JRE Still Available?

This is an important point for modern Java learners.

The term JRE is still useful for understanding Java architecture, but modern Java distributions are not always packaged as a separate JRE that you download and install.

Since Java 11, Oracle has generally stopped providing a separate JRE download in the way older Java versions did. Modern JDK distributions can create or provide runtime images appropriate for applications, and developers commonly install a JDK even when working primarily with Java applications.

Therefore, you should understand JRE as a runtime concept, rather than assuming that every modern Java installation has a separately installed JRE.

Do Developers Need to Install JRE Separately?

For modern Java development, developers normally install a JDK rather than separately installing a JRE.

The JDK contains the components needed for development and includes the Java runtime capabilities needed to run Java programs.

For example, after installing a JDK, you can check the Java runtime using:

java -version

And check the Java compiler using:

javac -version

If both commands work, your JDK installation is providing both the runtime and development capabilities.

Example of the Java Runtime

Suppose you have a compiled Java application:

Hello.class

You can run it with:

java Hello

The Java runtime starts the JVM, loads the required classes, verifies the bytecode, manages memory, and executes the application.

The user does not need to see these internal operations. They happen as part of the Java runtime process.

Why Is JRE Important to Understand?

Even though separate JRE installations are less common today, understanding the JRE concept helps you understand how Java applications work.

It explains the difference between developing an application and running an application.

For example:

Developer
   ↓
   JDK
   ↓
Java Source Code
   ↓
 Bytecode
   ↓
Runtime Environment
   ↓
   JVM
   ↓
Application

This distinction is particularly useful when learning about the relationship between the JDK, JRE, and JVM.

FAQs

What is JRE in simple words?

JRE is the traditional Java runtime environment that provides the JVM and Java libraries required to run Java applications.

Is JRE required to run Java programs?

A Java application needs a compatible Java runtime environment to execute. However, with modern Java, you do not necessarily install a separate JRE because a JDK can provide the required runtime components.

Does JRE contain JVM?

Yes. In the traditional Java architecture, the JRE contains the JVM along with the libraries and runtime components required to run applications.

Does JRE contain the Java compiler?

No. The Java compiler, javac, is a development tool provided by the JDK rather than the traditional JRE.

What is the difference between JRE and JVM?

The JVM executes Java bytecode, while the traditional JRE provides the JVM plus the libraries and supporting components needed to run Java application.