What is the difference between the JRE and JVM?

JvmJava

Jvm Problem Overview


I think the JVM is similar to the .NET Framework, correct? Then what is the JRE? What is the difference between the JRE and JVM?

Jvm Solutions


Solution 1 - Jvm

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- http://programmingbulls.com/difference-between-jre-and-jvm">CLICK HERE

Solution 2 - Jvm

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.

Solution 3 - Jvm

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.

Solution 4 - 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.

Solution 5 - Jvm

The Simple answer to this question is JRE is the super-set of JVM.

That is, the code which is compiled with java compiler(javac) produces the byte-code(.class files). jre which is the subset of jdk contains the required libraries along with jvm. jvm runs the byte-code and produces machine code that is in the machine readable form with the support of libraries required for that code.

To see the configuration of jvm go to : C:\Program Files\Java\jre7\lib\i386\jvm.cfg
This file contains the List of JVMs that can be used as an option to java, javac, etc.

Solution 6 - Jvm

The JRE includes the JVM, which is what actually interprets the byte code and runs your program. To do this the JVM uses libraries and other files provided by the JRE.

I believe you would say that the JRE is like the .NET Framework, while the JVM is like the .NET CLR. There are probably some important differences here I am not aware of though.

Solution 7 - Jvm

The JVM is the process that runs the Java code, and the JRE are all files distributed to form the "environment" in which the JVM runs.

Solution 8 - Jvm

JRE is an environment, in order to execute any Java program locally.

JVM is where it's responsible for converting the Bytecode into machine specific code and makes java program write-once-run-anywhere.

Solution 9 - Jvm

Java Virtual Machine (JVM) is an abstract virtual machine (basically, a program) that resides on your computer and provides a runtime environment for the Java bytecode (you program code after compilation) to get executed.

JVM analyze the bytecode, interprets it, and execute the same bytecode to display the output.

The basic function of JVM is to execute the compiled .class files (i.e. the bytecode) and generate an output. Do note, each operating system has a different JVM, but the generated bytecode output is the same across all operating systems. This means that the bytecode generated on Windows OS can also run on Linux OS and vice-versa, thus making Java as a platform independent language.

So, we can say that the JVM performs the following operations:

  1. Loading of the required .class and jar files
  2. Assigning references and verification of the code
  3. Execution of the code
  4. Provides a runtime environment for the Java bytecode

JRE (Java Runtime Environment), is JVM combined with the development tools needed to develop JVM compatible programs.

enter image description here

Check out the article to learn more about JVM.

Solution 10 - Jvm

JRE and JVM is part of JDK. jdk=jre(contains JVM)+Development tools.

JVM is specification and the name of JVM Implementaion is Hotspot or others, Implemented by different organizations.

Solution 11 - Jvm

According to Wikipedia:

>The JVM, which is the instance of the 'JRE' (Java Runtime Environment), comes into action when a Java program is executed. When execution is complete, this instance is garbage collected. JIT is the part of the 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.

Solution 12 - Jvm

JVM - java virtual machine is a specification for a run-time environment to execute byte code. JRE - java runtime environment is the implementation of jvm JDK - java developement kit, it's JRE + developement tools.

JRE has all the class libraries can support java application. When a java application is about to execute JRE will create JVM instance, which will actually runs the java application.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiondeleteView Question on Stackoverflow
Solution 1 - Jvmvipul_vjView Answer on Stackoverflow
Solution 2 - JvmWill MarcouillerView Answer on Stackoverflow
Solution 3 - JvmMahesh AthreyaView Answer on Stackoverflow
Solution 4 - JvmCrroodsView Answer on Stackoverflow
Solution 5 - JvmBalwant Kumar SinghView Answer on Stackoverflow
Solution 6 - JvmAndrew HubbsView Answer on Stackoverflow
Solution 7 - JvmDanielView Answer on Stackoverflow
Solution 8 - JvmKulasangarView Answer on Stackoverflow
Solution 9 - JvmJohnnyView Answer on Stackoverflow
Solution 10 - JvmRamanView Answer on Stackoverflow
Solution 11 - JvmJustin EthierView Answer on Stackoverflow
Solution 12 - JvmNu-ONEView Answer on Stackoverflow