![]() |
VOOZH | about |
Java Runtime Environment (JRE) is a software package that provides the environment required to run Java applications. It contains the Java Virtual Machine (JVM), core class libraries, and supporting files needed to execute Java bytecode. JRE is a part of the Java Development Kit (JDK) and is responsible for running Java programs on different platforms.
JRE consists of several components that work together to execute Java programs.
The JVM is the core component of JRE that executes Java bytecode.
Java class libraries provide pre-built classes and APIs required by Java applications.
Integration libraries help Java applications communicate with databases, remote systems, and other services. It includes JDBC, JNDI, RMI etc.
These libraries are used to build graphical user interfaces (GUI). It includes Swing, AWT, Java 2D , Image I/O etc.
Base libraries provide core functionalities required by Java applications. It includes java.lang , java.util , Collections Framework etc.
These libraries extend Java's capabilities. It includes JNI , JMX , Networking APIs etc.
Java Development Kit (JDK) and Java Runtime Environment (JRE) both interact with each other to create a sustainable runtime environment that enables Java-based applications to run seamlessly on any operating system. The JRE runtime architecture consists of the following elements as listed:
The Class Loader loads required classes into memory during program execution.
The Bytecode Verifier checks the generated bytecode before execution.
The Interpreter executes the verified bytecode.
JRE has an object of JVM with it, development tools, and library classes. To understand the working of Java Runtime Environment let us see an example of a simple Java program that prints "GeeksForGeeks".
Example:
GeeksForGeeks
Once you write your Java program, you must save it with a file name with a ".java" extension. Then after you Compile your program. The output of the Java compiler is byte code which is a platform-independent code. After compiling, the compiler generates a .class file that contains the byte code. Bytecode is platform-independent that runs on all devices which contain Java Runtime Environment (JRE).