• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Difference between JVM and JRE !!

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi !!

Just ran in to a bit of confusion figuring out what is the exact diference between JVM and JRE.

I mean, A JVM is a VIRTUAL MACHINE, that sits on top of your Software Platform and Simulates the characteristics of the underlying hardware/software. A JRE on the otherhand is the execution environment that a Java Program executes within... If This is correct then Is a JRE built into a JVM ? Also provide better explanation about JVM and JRE...

Can Somebody help me out on this plz...!!
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A JVM is just the "bare machine" -- the thing that executes .class files.

A JRE includes libraries and APIs (i.e., all the java.* and javax.* Java classes, plus things like the native libaries needed for the AWT to function.) So a JRE is a JVM plus more stuff.

You can't actually run a program on a bare JVM; there are a few APIs (the java.lang package, in particular) which the JVM can't function without.

A JDK (or J2SDK, as they used to call it) is a JRE plus all the development tools like javac, javap, rmic, etc.
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The JVM is part of the JRE. As EFH, the JRE also includes the standard Java API that is necessary to run any Java program.

Layne
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is a frequently asked question, you could have found the answer quickly by searching the forum...

Try this analogy.

The JVM is the engine.
The JRE is the complete car, including the engine.

The car (JRE) is not built into the engine (JVM), but the other way around.
 
Parth Bhatt
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okey...!! That solves my confusion to a great deal....!! Thanks a TON guys!!
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JVM is an application.
Where as JRE is JVM+All classes loaded i.e., JVM with initialization is known as JRE.
On one machine we can initialize any number of JVMs.
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch, Viswanath Rai. I think you have understood the problem correctly, and yes, you can run several JVMs simultaneously.
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had confusions regarding the JRE and JVM and I found this thread here. I have JDK 1.6 installed on my system. What will "javac -target 1.5" do? Will the compiled code run on a machine with JRE 1.5 ?
[ December 02, 2008: Message edited by: abhinav sinha ]
 
Campbell Ritchie
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please don't reopen such an old thread, particularly since this is a new question.
I am not sure, but I think that will mean it will run on a JDK5 machine, yes, but you need to ensure you don't use any classes or methods introduced in Java6 otherwise you will get a NoSuchMethodError or similar.

Best to try a tiny application and see what happens.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic