my dog learned polymorphism*
The moose likes Beginning Java and the fly likes JVM Vs JRE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "JVM Vs JRE" Watch "JVM Vs JRE" New topic
Author

JVM Vs JRE

Tom Lee
Greenhorn

Joined: Aug 25, 2005
Posts: 15
Hi all,
Could anyone explain me the difference between JVM and JRE ?

Thanx in advance,
Tom
Steve Morrow
Ranch Hand

Joined: May 22, 2003
Posts: 657

The JVM is the virtual machine in which your programs run. The JRE is the runtime environment that includes the JVM and supporting files.

http://faq.javaranch.com/view?SearchFirst
Pankaj Shirke
Greenhorn

Joined: Sep 28, 2005
Posts: 4
Difference between JRE and a JVM.
JVM is needed when you compile your source code.It is a part of Java SDK whereas JRE contains libraries which are required by your programs at runtime.
Once you compile a java code,form a class file and you port it to a different machine you only require JRE on that machine to run your program and no JVM/Java SDK.
Steve Morrow
Ranch Hand

Joined: May 22, 2003
Posts: 657

JVM is needed when you compile your source code.It is a part of Java SDK whereas JRE contains libraries which are required by your programs at runtime.
Once you compile a java code,form a class file and you port it to a different machine you only require JRE on that machine to run your program and no JVM/Java SDK.
That's not correct; all JREs include a JVM. Furthermore, a JVM is not necessary to compile Java source code; only run it.

For more information on the JVM, check out the following: The Java� Virtual Machine Specification
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14114
    
  16

An analogy:

JVM = only the engine
JRE = a complete car including the engine

If you want to drive, you need more than only the engine. You need a car, which includes the engine.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41599
    
  55
Furthermore, a JVM is not necessary to compile Java source code; only run it.

Of course, if you use the "javac" compiler, you do need a JVM, because javac is implemented in Java, so it needs a JVM to run. (As a counter-example, IBMs jikes compiler is written in C, so it needs no JVM to run.)

Besides some tools and supporting files, the biggest part of the JRE that is not part of the JVM are the class libraries.
[ September 29, 2005: Message edited by: Ulf Dittmer ]

Ping & DNS - my free Android networking tools app
Steve Morrow
Ranch Hand

Joined: May 22, 2003
Posts: 657

[QUOTEAn analogy:

JVM = only the engine
JRE = a complete car including the engine
Good analogy. So good, in fact, that I'm going to start referring to my vehicle as a DRE (Dodge Runtime Environment)...
Naveen Vooka
Greenhorn

Joined: Oct 13, 2004
Posts: 25
Java Runtime Environment - The JRE consists of the Java virtual machine, the Java platform core classes, and supporting files. It is the runtime part of the Java Development Kit -- no compiler, no debugger, no tools. The JRE is the smallest set of executables and files that constitute the standard Java platform.

Java Virtual Machine. An abstract computing machine, or virtual machine, JVM is a platform-independent programming language that converts Java bytecode into machine language and executes it. Most programming languages compile source code directly into machine code that is designed to run on a specific microprocessor architecture or operating system, such as Windows or UNIX. A JVM -- a machine within a machine -- mimics a real Java processor, enabling Java bytecode to be executed as actions or operating system calls on any processor regardless of the operating system. For example, establishing a socket connection from a workstation to a remote machine

--------------
Naveen Vooka
www.devsquare.com
DevSquare - Online Application Development
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JVM Vs JRE