Wish to have some nice time? Check out what I'm reading online!

Differentiate JVM JRE JDK JIT

May 10th, 2009

Java Virtual Machine (JVM) is an abstract computing machine. Java Runtime Environment (JRE) is an implementation of the JVM. Java Development Kit (JDK) contains JRE along with various development tools like Java libraries, Java source compilers, Java debuggers, bundling and deployment tools.

JVM becomes an instance of JRE at runtime of a java program. It is widely known as a runtime interpreter. The Java virtual machine (JVM) is the cornerstone on top of which the Java technology is built upon. It is the component of the Java technology responsible for its hardware and platform independence. JVM largely helps in the abstraction of inner implementation from the programmers who make use of libraries for their programmes from JDK.

Diagram to show the relations between JVM JRE JDK

Diagram to show the relations between JVM JRE JDK

JVM Internals

Like a real computing machine, JVM has an instruction set and manipulates various memory areas at run time. Thus for different hardware platforms one has corresponding implementation of JVM available as vendor supplied JREs. It is common to implement a programming language using a virtual machine. Historicaly the best-known virtual machine may be the P-Code machine of UCSD Pascal.

A Java virtual machine instruction consists of an opcode specifying the operation to be performed, followed by zero or more operands embodying values to be operated upon. From the point of view of a compiler, the Java Virtual Machine (JVM)is just another processor with an instruction set, Java bytecode, for which code can be generated. Life cycle is as follows, source code to byte code to be interpreted by the JRE and gets converted to the platform specific executable ones.

Sun’s JVM

Sun’s implementations of the Java virtual machine (JVM) is itself called as JRE. Sun’s JRE is availabe as a separate application and also available as part of JDK. Sun’s Java Development Tool Kit (JDK) comes with utility tools for byte code compilation “javac”. Then execution of the byte codes through java programmes using “java” and many more utilities found in the binary directory of JDK. ‘java’ tools forks the JRE. Implementation of JVMs are also actively released by other companies besides Sun Micro Systems.

JVM for other languages

A JVM can also be used to implement programming languages other than Java. For example, Ada source code can be compiled to Java bytecode, which may then be executed by a Java virtual machine (JVM). That is, any language with functionality that can be expressed in terms of a valid class file can be hosted by the Java virtual machine (JVM). Attracted by a generally available, machine-independent platform, implementors of other languages are turning to the Java virtual machine (JVM) as a delivery vehicle for their languages. PHP with Quercus is such an example.

Just-in-time Compiler (JIT)

JIT is the part of the Java Virtual Machine (JVM) that is used to speed up the execution time. JIT compiles parts of the byte code that have similar functionality at the same time, and hence reduces the amount of time needed for compilation. Here the term “compiler” refers to a translator from the instruction set of a Java virtual machine (JVM) to the instruction set of a specific CPU.

Hi Joe,

Explanation on each are really good.

Thanks and Regards
Srikanth S

Srikanth S on May 11th, 2010 2:48 pm

Thanks Srikanth.

Joe on May 11th, 2010 9:58 pm

The picture about the implementation is good. However, I read in the first paragrapth tha JRE is an implementation of JVM and in the very next the I read the reverse of it.

Can you confirm if JRE is the implementation of JVM or JVM is the implementation of JRE?

Also, if JRE is an implementation of JVM, then I assue [JDK, JIT, Compiler] will all come under JDK.

Please confirm my understanding.

Shreyas on July 9th, 2010 7:45 pm

What you read in the first paragraph and in the next paragraph means the same.

“Java Runtime Environment (JRE) is an implementation of the JVM”. “JVM becomes an instance of JRE at runtime”. These are the two statements you are referring to.

They mean the same. If the second statement is confusing to understand the relationship between jvm and jre, just ignore it. If you understand the larger picture that “Java Runtime Environment (JRE) is an implementation of the JVM” is good.

Over a period, you will digest the complete relationship and difference between jre and jvm.

Joe on July 10th, 2010 3:39 am

Realy a nice Explainasion ………

Anonymous on July 21st, 2010 7:03 am

I like ur explainasion…..it realy anice one….thnks 4 it.

Amol Bhuibhar on July 21st, 2010 7:04 am





hidden and gravatar enabled.