What is the Java Runtime Environment?

The Java Runtime Environment (JRE) is software that Java programs require to run correctly. Java is a computer language that powers many current web and mobile applications. The JRE is the underlying technology that communicates between the Java program and the operating system. It acts as a translator and facilitator, providing all the resources so that once you write Java software, it runs on any operating system without further modifications.

Why is the JRE important?

A software program needs a runtime environment that provides access to memory and other system resources such as program files and dependencies. In the past, most software used the operating system directly as its runtime environment. However, this meant that developers had to write different code for each operating system that they wanted their applications to run on. The Java Runtime Environment (JRE) technology was created as a solution to this problem.

 

The JRE is actually one of three Java platform components that are required for any Java program to run successfully. The Java Development Kit (JDK) and Java Virtual Machine (JVM) are the other two components.

Java Development Kit

The JDK is a collection of software tools that you can use for developing Java applications. You can set up the JDK in your development environment by downloading and installing it. Select the JDK software version that matches the Java version you want to use. For example, Java Standard Edition, or Java SE, requires the Java SE JDK.

Java Virtual Machine

The JVM is software that runs the Java program line by line. Developers configure the JVM settings to manage program resources when the Java application runs. For example, you can change the JVM memory setting and check how much internal memory your Java applications use at runtime.

Role of the JRE in Java programming language

The JRE combines the Java code that you create by using the JDK with additional built-in code called libraries. It then creates a JVM instance, or local copy, that finally runs the Java programs. JVMs are available for multiple operating systems, and the JRE generates a single copy of your Java code that runs on all types of JVMs. In this way, the JRE facilitates platform independence for Java applications. You can write them once and run them anywhere.

Difference between the JRE, JVM, and JDK

The JDK is a software layer above the JRE that contains a compiler, a debugger, and other tools commonly found in any software development environment. You write code in English-like syntax in the JDK. The JDK compiles it and passes the byte code to the JRE. In contrast, the JRE contains class libraries, supporting files, and the JVM. It uses these software components to run the byte code on any device.

How does the JRE work?

The Java Runtime Environment (JRE) runs on top of the operating system, providing additional Java-specific resources. The Java Development Kit (JDK) and JRE interact to create a sustainable runtime environment that runs Java program files on any machine. The JRE uses three core components to work.

ClassLoader

Java class libraries contain collections of pre-written code that you can call as needed. They simplify the job of Java developers by providing built-in methods for common and non-trivial tasks such as taking input from users, displaying output to users, and more. All Java programs reference several class libraries. The Java ClassLoader dynamically loads all class files necessary into the Java Virtual Machine (JVM) on demand.

Bytecode verifier

The JDK has a compiler that converts the English-like code you write into a machine language version called Java bytecode. They bytecode verifier in the JRE checks the format and accuracy of the Java code before loading it into the JVM. For example, if the code violates system integrity or access rights, the JRE will not load the class file.

Interpreter

After the bytecode successfully loads, the Java interpreter creates the JVM instance that runs the Java program on the underlying machine.

What are the components of the JRE?

Other than the core components, the Java Runtime Environment (JRE) contains several other software components that help run Java programs more efficiently. The following are some examples:

Development tools

The JRE contains development tools such as user interface toolkits that you can use to improve the quality of your applications. The following are some examples:

Java 2D

Java 2D is an application programming interface (API) that you can use to draw two-dimensional graphics and create rich user interfaces, games, animations, and special effects in the Java language.

Swing

Swing is a lightweight graphical user interface (GUI) that offers flexible, user-friendly customizations.

Abstract Window Toolkit

Abstract Window Toolkit (AWT) is a GUI that you can use to create UI objects such as buttons, windows, and scroll bars.

Deployment solutions

The JRE includes technologies that simplify the process of releasing software changes to application users. These technologies also provide advanced support for updates in the application. Deployment technologies such as Java Web Start and Java plugin are included as part of the JRE installation. These technologies simplify the activation of applications and also provide advanced support for future updates to the JRE. The following are some examples:

Java Web Start

With Java Web Start, you can launch full-featured applications with a single click from your web browser.

Java Plugin

Java plugin establishes a connection between popular browsers and the Java platform so that you can run your website applets within a desktop browser.

Language and utility libraries

A collection of Java class files is called a Java package. The JRE includes several Java packages that support versioning, management, and monitoring. The following packages are some examples:

Collections framework

The collections framework is a unified architecture that includes interfaces for improving the storage and processing of application data.

Preferences API

The Preferences API allows multiple users on the same machine to define their own group of application preferences.

Logging

Logging packages produce log reports for troubleshooting incidents such as security failures, performance issues, and configuration errors.

Java Archive

Java Archive (JAR) is a platform-independent file format that lets you bundle multiple files to reduce your application file sizes and significantly improve download speed.

Integration libraries

The JRE includes several integration libraries that assist developers in creating seamless data connections between their services and applications. The following are some example libraries:

Java IDL

Java Interface Definition Language (IDL), which is based on the Common Object Request Broker Architecture (CORBA), supports distributed data objects—that is, objects that interact on different platforms across a network. For example, Java IDL allows objects written in Java to interact with those written in another language, such as C, C++, or COBOL.

Java Database Connectivity

Developers use the Java Database Connectivity (JDBC) API to write applications that can access remote databases, spreadsheets, and files.

Java Naming and Directory Interface

Java Naming and Directory Interface (JNDI) is a directory service that lets clients create portable applications that fetch information from external databases using naming rules.

What is AWS SDK for Java?

The AWS Software Development Kit (SDK) for Java simplifies the use of AWS services by providing a set of libraries that are consistent and familiar for Java developers. It supports higher-level abstractions for simplified development. AWS focused open-source Java libraries are available along with code examples and a Java API reference guide.

 

The AWS SDK for Java 2.0 code examples on GitHub contain Java code examples and real-world use cases for AWS services to help accelerate the development of your applications. In addition, the AWS SDK for Java API Reference Guide describes the API operations for the latest version of the AWS SDK for Java. The reference guide also provides sample requests, responses, and errors for the supported web services protocols.

 

Get started with AWS SDK for Java using the AWS SDK for Java Developer Guide, or visit the AWS Java Developer Center.                                       

Next steps on AWS