What is the difference between the JRE and JVM?

In layman terms:-

JDK = JRE + Development/debugging tools, where JDK is our complete package to work with Java, from creating compiling till running it.On the other hand JRE is just of running of code(Byte Code).

Note:- Whether we are installing JDK or JRE, JVM would come bundled with both the packages and JVM is the part where JIT compiler converts the byte code into the machine specific code.

JVM is Java Virtual Machine -- the JVM actually runs Java bytecode.
JDK is Java Developer Kit -- the JDK is what you need to compile Java source code.
JRE is Java Runtime Environment -- is what you need to run a Java program and contains a JVM, among other things.

The JRE is the environment within which the virtual machine runs.

JRE - JAVA Runtime Environment

JVM - JAVA Virtual Machine

JRE is the container, JVM is the content.


First of all JDK contains JRE+development tools, JRE contains JVM+class libraries, where JVM contains (class loader & byte code verifier) and the Execution engine (interpreter & JIT).

The compiler will convert the source code into intermediate byte codes. Where this byte codes is given to JVM for execution, the class loader in the JVM will load the byte codes and does linking with class libraries provided by the JRE.

Then the code will be given to the execution engine in the JVM which interprets the unrepeated code and compiles the repeated code (for example loops) finally converting into machine code (object code). Then it will give the machine code to the microprocessor for execution.


Java Runtime Environment contains JVM, class libraries, and other supporting files.

It does not contain any development tools such as compiler, debugger, etc.

Actually JVM runs the program, and it uses the class libraries, and other

supporting files provided in JRE.

JRE = JVM + Java Packages Classes (like util, math, lang, awt, swing etc) + runtime libraries.

If you want to run any Java program, you need to have JRE installed in the system.

JRE is the box and JVM is the content of the box.

In simple words JRE = JVM + rt.jar

where rt.jar contains lang, util, awt, swing, math etc. libraries or compiled .class files used to run our program.

Learn more about difference between JVM and JRE- CLICK HERE

Tags:

Java

Jvm