JRE in Java

26 Oct, 2021
Java Runtime Environment (JRE) is an open-access software distribution that has a Java class library, specific tools, and a separate JVM. JRE is one of the interrelated components in the Java Development Kit (JDK). It is the most common environment available on devices for running Java programs. Java source code is compiled and converted to Java bytecode. If you want to run this bytecode on any platform, you need JRE. The JRE loads classes check memory access and get system resources. JRE acts as a software layer on top of the operating system.
Integration libraries include Java Database Connectivity (JDBC)
Java Naming, Interface Definition Language (IDL)
Directory Interface (JNDI)
Remote Method Invocation Over Internet Inter-Orb Protocol (RMI-IIOP)
Remote Method Invocation (RMI)
Scripting
Java Virtual Machine (JVM) consists of Java HotSpot Client and Server Virtual Machine.
User interface libraries include Swing, Java 2D, Abstract Window Toolkit (AWT), Accessibility, Image I/O, Print Service, Sound, drag, and drop (DnD), and input methods.
Lang and util base libraries, which include lang and util, zip, Collections, Concurrency Utilities, management, Java Archive (JAR), instrument, reflection,  versioning, Preferences API, Ref Objects,  Logging,  and Regular Expressions.
Other base libraries, including Java Management Extensions (JMX), Java Native Interface (JNI), Math, Networking, international support, input/output (I/O), Beans, Java Override Mechanism, Security, Serialization, extension mechanism, and Java for XML Processing (XML JAXP).
Deployment technologies such as Java Web Start, deployment, and Java plug-in.
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:
ClassLoaderByteCode verifierInterpreter
ClassLoader
ByteCode verifier
Interpreter
Now let us brief about them as follows:
ClassLoader: Java ClassLoader dynamically loads all the classes necessary to run a Java program. Because classes are only loaded into memory whenever they are needed, the JRE uses ClassLoader will automate this process when needed.  
Bytecode Verifier: The bytecode checker ensures the format and precision of Java code before passing it to the interpreter. If the code violates system integrity or access rights, the class is considered corrupt and will not load.  
Interpreter: After loading the byte code successfully, the Java interpreter creates an object of the Java virtual machine that allows the Java program to run natively on the underlying machine.
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:
Java
// Java classclass GFG {        // Main driver method     public static void main(String[] args) {                // Print statement         System.out.println("GeeksForGeeks");    }}
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).
java-basics
Picked
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.