×

JRE (Java Runtime Environment)

JRE is an installation package that provides an environment to run the Java program on any Operating System. It does not deal with the development process of any application. It is a part of the Java Development Kit (JDK). It is a software distribution that has Java Class Library, specific tools, and a stand-alone JVM.

JRE

JRE is the most common environment available on devices to run Java programs. The source codes are compiled and translated to Java bytecode. If we want to run this bytecode on any Operating System, we just need a specific JRE for that Operating System that is available freely on the Oracle website. The JRE fetch classes, verify access to memory, and retrieves the system resources that are required by the created software.

Java Runtime Environment works as a layer on the top of the OS and also includes:

  • It includes the technologies that are used for the deployment, such as Java Web Start and Java plug-in.
  • JRE contains the toolkits for user interface like Java 2D, AWT (Abstract Window Toolkit), Swing, Image I/O, print service, sound, etc.…
  • It provides integration libraries such as JDBC (Java Database Connectivity) and JNDI (Java Naming and Directory Interface), IDL (Interface Definition Language), RMI (Remote Method Invocation), etc.
  • It contains lang, util, zip, Java Archive (JAR), instrument, reflection, Collections, Concurrency Utilities, management, versioning, Logging, Preferences API, etc.…  
  • Other base libraries such as input/output (I/O), extension mechanism, Beans, JMX (Java Management Extension), Java Native Interface, and JAX-WS (Java for XML Processing).

Working of JRE

Once we write any source code, we have to save it with the .java extension. Next we compile our program using the “javac” command in command prompt (no need in any IDE). It translates the code to the bytecode which is platform-independent. When we compile our program it will generate a .class which has the bytecode for the equivalent java file. And that bytecode is executed on any platform having the JRE. The workflow is explained below.

  • ClassLoader- It loads the various classes dynamically in the JVM (Java Virtual Machine), which are essential for executing the program. After JVM started following three class loader are used:
    • Bootstrap class loader
    • Extension class loader
    • System class loader
  • Byte code verifier- It verifies the bytecode during the run time so that the code doesn’t make any disturbance for the interpreter. The codes are interpreted, only if it passes the tests of the bytecode verifier that check the formatting and for illegal code.
  • Interpreter- When class loaded and code gets verified, then it reads the assembly code line by line and process the following two functions:
  • It executes the Byte Code.
  • Make appropriate calls to the integrated hardware.

Related Topics

How to compare two dates in different format in Java?

We need to compare two dates frequently when coding. Real-world examples include sorting a list of persons by age or keeping track of students' attendance. To compare two dates, we...

7 minutes read.

Generic queue in Java

Before understanding how to implement a generic queue in java, one must know about generics and queue in java. Generics in Java Generics are parameterized types. The goal is to enable type...

6 minutes read.

Difference between JIT and JVM in Java

In this tutorial, we will discuss the difference between JIT (Just In Time Compiler) and JVM (Java Virtual Machine) in Java. Before we move to the differences, let's understand what...

4 minutes read.

Java Integer toOctalString() method

The toOctalString() method of Java Integer class returns a string representing the specified int argument as an unsigned integer in base 8. Syntax public static String toOctalString (int  i) Parameters The parameter ‘i’ represents...

1 minute read.

Class vs Object in Java

Java : Java is a pure object oriented language. It was introduced by James Gosling in the year 1995. The first public implementation of java was done by sun micro systems...

7 minutes read.

How to compare dates in Java

Introduction: In Java, dates can be compared using a similar interface's compareTo() technique. This method returns 'zero' if each date is the same, returns a rate "more than 0" if...

6 minutes read.

String Array in Java

String Array in Java An array is alinear data structure that stores similar type of data. It allows us to store fixed number of elements.It can be of different data types...

6 minutes read.

Java Developer

Who is a Java Developer? A Java developer is a skilled programmer who works on commercial applications, software, and webpages.  Java developers can work in two different areas: Operating system development:...

3 minutes read.

Davis Staircase Problem in Java

Davis has several stairs in his home and prefers to ascend one, two, or three steps at a time. As a highly clever youngster, he thinks about how many ways...

3 minutes read.

How to declare string array in Java

Introduction Array is a data structure with a fixed size, which allows us to store elements of similar type. Data of primitive types like int, char, float, string, etc. can be...

2 minutes read.

Prepared statement in Java

Prepared statement: A prepared statement is a statement that is pre-compiled SQL statement, and it is a sub-interface of a statement. Compared to other statement objects in java, Prepared Statement objects have...

3 minutes read.

Java Enum

Enumerations are used in programming languages to represent collections of named constants. For instance, the four suits in a deck of playing cards might represent four iterators named Club, Diamond,...

3 minutes read.

Rectangular Numbers in Java

In this tutorial, we will understand the meaning of a rectangular number in Java with the aid of examples, illustrations, and implementations. It is one of the popular coding interview...

3 minutes read.

Sum of digits in string in java

To find the sum of all digits in a string, you need to traverse through the string one by one character; if the character is an integer, you need to...

2 minutes read.

Narcissistic Number in Java

A Narcissistic number is made up of digits that have been added together and raised to powers equal to the number of digits in the original number. In those other...

3 minutes read.

Interface Program in Java

Interface Program in Java In the previous topic, we discussed that abstraction is possible through the interface and abstract class. An abstract class provides partial to 100% abstraction. 100 %abstraction in...

4 minutes read.

Java Location

PATH is an environmental variable that the system software now uses to find executable files (.exe) or Java binaries ( java or javac command). Once chosen, a route cannot be...

3 minutes read.

Switch Case Program in Java

Switch Case Program in Java The switch case program in Java controls which code snippet gets executed on the basis of the value of the expression mentioned in the switch statement....

22 minutes read.

Java calculate age

In this section, we will create a Java program that calculates age from the given date of birth or current date. In order to get the date of birth from the current...

6 minutes read.

Java While Keyword

Depending on a specified Boolean condition, a while loop in Java allows code to be executed repeatedly. The while loop can be viewed as an iterative version of the if...

3 minutes read.