JRE (Java Runtime Environment)
What is the JRE (Java Runtime Environment)?
The Java Runtime Environment, or JRE, is a software layer that runs on top of a computer’s operating system software and provides the class libraries and other resources that a specific Java program needs to run.
The JRE is one of three interrelated components for developing and running Java programs. The other two components are as follows:
- The Java Development Kit, or JDK, is a set of tools for developing Java applications. Developers choose JDKs by Java version and by package or edition—Java Enterprise Edition (Java EE), Java Special Edition (Java SE), or Java Mobile Edition (Java ME). Every JDK always includes a compatible JRE, because running a Java program is part of the process of developing a Java program.
- The Java Virtual Machine, or JVM, executes live Java applications. Every JRE includes a default JRE, but developers are free to choose another that meets the specific resource needs of their applications.
The JRE combines Java code created using the JDK with the necessary libraries required to run it on a JVM and then creates an instance of the JVM that executes the resulting program. JVMs are available for multiple operating systems, and programs created with the JRE will run on all of them. In this way, the Java Runtime Environment is what enables a Java program to run in any operating system without modification.
You can download the JDK, including a compatible JRE, from Oracle (link resides outside IBM).
How does JRE work?
The JDK and JRE interact with one another to create a sustainable runtime environment that enables the seamless execution of Java-based applications in virtually any operating system. The following make up the JRE runtime architecture:
ClassLoader
The Java ClassLoader dynamically loads all classes necessary to run a Java program. Since Java classes are only loaded into memory when they’re required, the JRE uses ClassLoaders to automate this process on demand.
Bytecode verifier
The bytecode verifier ensures the format and accuracy of Java code before it passes to the interpreter. In the event that code violates system integrity or access rights, the class will be considered corrupted and won’t be loaded.
Interpreter
After the bytecode successfully loads, the Java interpreter creates an instance of the JVM that allows the Java program to be executed natively on the underlying machine.
What does JRE consist of?
Besides the Java Virtual Machine, JRE is composed of a variety of other supporting software tools and features to get the most out of your Java applications.
Deployment solutions
Included as part of the JRE installation are deployment technologies like Java Web Start and Java Plugin that simplify the activation of applications and provide advanced support for future Java updates.
Development toolkits
The JRE also contains toolkits designed to help developers improve their user interface. Some of these toolkits include:
- Java 2D: An Application Programming Interface (API) used for drawing two-dimensional graphics in Java language. Developers can create rich user interfaces, special effects, games, and animations.
- Abstract Window Toolkit (AWT): A GUI (Graphical User Interface) used to create objects, buttons, scroll bars, and windows.
- Swing: Another lightweight GUI that uses a rich set of widgets to offer flexible, user-friendly customizations.
Integration libraries
Java Runtime Environment provides a number of integration libraries to assist developers in creating seamless data connections between their applications and services. Some of these libraries include:
- Java IDL (CORBA): Uses Common Object Request Architecture to support distributed objects written in Java programming language.
- Java Database Connectivity (JDBC) API: Provides tools for developers to write applications with access to remote relationship databases, flat files, and spreadsheets.
- Java Naming and Directory Interface (JNDI): A programming interface and directory service that lets clients create portable applications that can fetch information from databases using naming conventions.
Language and utility libraries
Included with the JRE are java.lang. and java.util. packages that are fundamental for the design of Java applications, package versioning, management, and monitoring. Some of these packages include:
- Collections Framework: A unified architecture made up of a collection of interfaces designed to improve the storage and process of application data.
- Concurrency Utilities: A powerful framework package with high-performance threading utilities.
- Preferences API: A lightweight, cross-platform persistent API that enables multiple users on the same machine to define their own group of application preferences.
- Logging: Produces log reports—such as security failures, configuration errors, and performance issues—for further analysis.
- Java Archive (JAR): A platform-independent file format that enables multiple files to be bundled in JAR format, significantly improving download speed and reducing file size.
JRE and IBM
For many organizations, Java continues to be a vital part of application development and provides a solid foundation when creating portable and scalable solutions. It can also serve a key role in modernizing applications on the journey to cloud.
Take the next step:
- Explore OpenJDK and IBM Runtimes for Business, which provides reliable and cost-effective commercial support for implementing, monitoring and managing Java applications.