JRE, Java Runtime Environment:
JRE (Java Runtime Environment) is a software package which consists of some components to form a possible environment for Java programmers. To make the Java code run smoothly on any machine whether it is IBM, Apple, Intel or a Mobile platform. Now under JRE there are several other components like
Java Virtual Machine (JVM)
Java class library
JVM (Java Virtual Machine)
JVM is a virtual machine which is above the layer of an operating system and the machine which you are using for programming purposes. In JVM there is a JIT (Just In Time Processor) which processes the Java code before it is sent to the operating system layer and the processor. The main purpose of JVM is that there can be different machines with different architectures and different operating systems. It was possible that your code written in Java cannot be processed in a machine in the same manner as it was processed with a machine of different architecture and different operating system. So, to provide a common platform JVM was introduced. JVM provides the code written in Java a familiar environment in which it will provide the same results in all the machines irrespective of their operating systems and hardware architectures.
Java Class Library:
Like all other programming languages, JAVA also provides Java class libraries. These libraries provide many of the functionalities of the modern operating system. Like Swing in Java not only provides an interface to the user but it also handles all the operations of an interface just like a small module of the operating system. You can perform many common tasks like maintain a list of items by using Java class library.
Many common tasks like maintain a list of items are provided by Java class libraries. Similarly, Java also provides an abstract interface with the help of Java class library. This abstract interface is free from the dependency of hardware and operating system. By using this interface, you can do anything you want. This abstract interface is translated into the operating system and hardware level code. So, it gives those instructions to the hardware and the operating system which are understandable by both. Those class libraries also provide network access and file access facilities to users. Those network access and file access facilities are built-in Java as libraries like java.net and java.io. But after all this still, it is possible that some platforms do not support Java.
So, in this case, Java class handles all the things very nicely, it either finds the suitable components or finds the substitute of the suitable components.