JRE – Shishir Kant Singh https://shishirkant.com Jada Sir जाड़ा सर :) Fri, 29 May 2020 08:48:35 +0000 en-US hourly 1 https://wordpress.org/?v=6.8.1 https://shishirkant.com/wp-content/uploads/2020/05/cropped-shishir-32x32.jpg JRE – Shishir Kant Singh https://shishirkant.com 32 32 187312365 Difference between JDK, JRE, JVM https://shishirkant.com/difference-between-jdk-jre-jvm/?utm_source=rss&utm_medium=rss&utm_campaign=difference-between-jdk-jre-jvm Fri, 29 May 2020 08:48:31 +0000 http://shishirkant.com/?p=1264 We must understand the basic difference between the JDK, JRE, and JVM before diving deep into Java.

Difference between JDK JRE JVM
JDKJREJVM
JDK stands for Java Development Kit. It provides development tools and execution environment. JRE stands for Java Runtime Environment. It provides the set of tools only to execute our program.JVM stands for Java Virtual Machine. It is responsible for the program to execute line by line.
JDK is the superset of the JRE. It contains JRE with Java compiler, debugger, and core classes.JRE contains a set of libraries and other files that JVM uses at runtime.It contains JIT (Just in Time Compiler), interpreter, and set of APIs. JIT optimizes bytecode to machine specific language compilation by compiling similar bytecodes.
Uses JVM, interpreter/loader, a compiler, an archiver, a documentation generator (Javadoc), and set of APIs to complete the development of Java application.Uses a set of libraries, other jar files, and set of API to run the program. It doesn’t play any role during development. It only works to run the program.JVM works to Load code, Verifies code, and Execute code and provides a runtime environment.
It physically exitsIt physically exitsIt doesn’t physically exist.
]]>
1264
Java Runtime Environment (JRE) https://shishirkant.com/java-runtime-environment-jre/?utm_source=rss&utm_medium=rss&utm_campaign=java-runtime-environment-jre Fri, 29 May 2020 08:40:53 +0000 http://shishirkant.com/?p=1260 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.
]]>
1260