JVM vs JRE
Java is a cross-platform programming language. It also adheres to the “write once, run anywhere” principle. The program written in Java can be compiled in to Java bytecode by the Java compiler. Then, the bytecode can be executed on any platform running the JRE (Java Runtime Environment). JRE includes the JVM (Java Virtual Machine), base libraries (which implements the Java API) and other supporting files. JVM is an abstract computing machine that acts as a mediator between the platforms specific JRE and the Java code.
What is JVM?
JVM is a type of virtual machine that is used by machines to execute Java bytecode. According to Sun Microsystems (who developed Java until it was bought by Oracle, very recently), there are more than 4 billion JVM enabled devices in the world. More specifically, Java Virtual Machine is an abstract computing machine implemented on standard hardware and operating system. One of the important functionality provided by the JVM is automated exception handling. Typically, a collection of standard libraries accompany the JVM. In fact, JRE is a bundle containing the JVM and the classes that implement the Java API. JVM is a very important component, which accommodates the “compile once, run anywhere” nature of the Java programming language. As long as the JVM is running, your Java code can run on top of it, regardless of the platform used in the machine. This is why Java is called a cross-platform or multi-platform language.
Read More: 1Z0-900: Java EE 7 Application Developer
What is JRE?
JRE is the execution environment on which Java code is run. Typically, JRE is composed of the JVM, standard base classes (that implement the base Java API) and other supporting files. Type and structure of JRE vary depending on the operating system and the CPU architecture. When the Java code is run, the JRE will communicate with the operating system, which in turn will talk with the corresponding hardware components. Having JRE installed on your system is a must to run any java code on your machine. However, JRE does not include a compiler, debugger or any other tools needed for the development of Java programs (such as appletviewer and javac). If you need to develop programs in Java, you need to have the JDK (Java Development Kit), which includes the JRE as well.
What is the difference between and JVM and JRE?
Although, in everyday use, the terms JVM and JRE are being used interchangeably, they have their differences. JVM is a virtual machine that runs on top of the operating system, while JRE is the runtime execution environment. JVM is a part of the JRE. JVM specification acts as the link between the platform-specific JRE implementation and the standard Java libraries. Therefore, JVM is the entity that provides the abstraction from the inner implementation details to the programmer. And it is responsible for interpreting the compiled bytecode. However, JVM needs the base libraries and other supporting files to execute the java bytecode. But sometimes, JRE is simply identified as an implementation of JVM.
0 comments:
Post a Comment