aspose file tools*
The moose likes Beginning Java and the fly likes Difference between JVM and JRE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Difference between JVM and JRE" Watch "Difference between JVM and JRE" New topic
Author

Difference between JVM and JRE

elysee chung
Greenhorn

Joined: Jul 25, 2004
Posts: 7
Sorry, stupid question!
What is the difference between JVM and JRE ?
Ben Buchli
Ranch Hand

Joined: Mar 26, 2004
Posts: 83
JVM = JavaVirtualMachine
JRE = JavaRuntimeEnvironment

JVM is included in JRE and runs your code. If you want to develop java apps, you need the JavaDeveloperKit (JDK).
elysee chung
Greenhorn

Joined: Jul 25, 2004
Posts: 7
>>> "JVM is included in JRE and runs your code. "

Why use JRE not JVM ?
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
The JVM is one of the parts of the JRE. Other parts include jars, dlls (or whatever Unix uses), fonts, properties, images, etc. Install the JRE and find a whole bunch o files in there. You need lots of them to run any program. Hope that helps!


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
elysee chung
Greenhorn

Joined: Jul 25, 2004
Posts: 7
So, If we want to run Java program, we should install JRE not JVM ?

(Java program run on JRE only!)
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
Yes, you should install the JRE (which contains the JVM) and not install only the JVM.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Robert Konigsberg
Ranch Hand

Joined: Jun 23, 2004
Posts: 172
Are you trying to solve a larger problem, or are you just interested?


SCJP 1.4 (91%)<br />SCJD 1.4 (376/400, 94%)
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
I don't think you even *can* install the JVM seperately, can you?


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Ken Okoli
Greenhorn

Joined: Dec 19, 2003
Posts: 3
JVM = JavaVirtualMachine
JRE = JavaRuntimeEnvironment

The JVM sits between your program and the computer. It creats a hypothetic compter that has a program called an interpreter used to convert your written code into byte codes 1's and 0's which the JVM can handle with the help of your processor(hardware.
I think of the JRE as the process and eviroment in which you come in to say where what happens, maybe a console for javac and not the code editor itself.
JVM is included in JRE and runs your code. If you want to develop java apps, you need the JavaDeveloperKit (JDK).
i guess the JDK contains both.It's the Java Development Kit.


KNOWLEDGE IS POWER.....SPREAD THE LOVE
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
KEN O.,

Welcome to JavaRanch!

We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.

We request something more than an initial for the last name.

Thanks Pardner! Hope to see you 'round the Ranch!


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
elysee chung
Greenhorn

Joined: Jul 25, 2004
Posts: 7
From java web site
http://java.sun.com/docs/books/tutorial/getStarted/intro/definition.html
**********
Java bytecodes help make "write once, run anywhere" possible.
You can compile your program into bytecodes on any platform that has a Java compiler.
The bytecodes can then be run on any implementation of the Java VM.
That means that as long as a computer has a Java VM,
the same program written in the Java programming language can run on Windows 2000, a Solaris workstation, or on an iMac.
***********

I never find any article explain the difference between JVM & JRE.
(or JVM is a concept only, no real implementation)
Ben Buchli
Ranch Hand

Joined: Mar 26, 2004
Posts: 83
Elysee, I think this is a nice explanation:
Originally posted by KEN O.:


The JVM sits between your program and the computer. It creats a
hypothetic compter that has a program called an interpreter used to convert your written code into byte codes 1's and 0's which the JVM can handle with the help of your processor(hardware.
I think of the JRE as the process and eviroment in which you come in to say where what happens, maybe a console for javac and not the code editor itself.
JVM is included in JRE and runs your code. If you want to develop java apps, you need the JavaDeveloperKit (JDK).
i guess the JDK contains both.It's the Java Development Kit.
elysee chung
Greenhorn

Joined: Jul 25, 2004
Posts: 7
So
JVM is included in JRE, and JRE is included in JDK.
Because there is no JVM's implementation only.
If we want to run Java program,
we should install JRE.
(Though we need JVM only.)
elysee chung
Greenhorn

Joined: Jul 25, 2004
Posts: 7
Sorry question again!

According to Java web site
http://java.sun.com/docs/books/tutorial/getStarted/intro/definition.html
******
The bytecodes can then be run on any implementation of the Java VM.
******

1.Running Java program we need JVM only.
2.JVM is included in JRE. ==> JRE have many extra function than JVM.
3.We can not use those extra function inside the Java program.
(Because JVM don't included those extra function.)

Question is

From Java web site
http://java.sun.com/docs/books/tutorial/getStarted/intro/cando.html

The figure (gs5.gif)

Which part is JVM ?
Java HotSpot Runtime ?
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

Originally posted by KEN O.:

The JVM sits between your program and the computer. It creats a hypothetic compter that has a program called an interpreter used to convert your written code into byte codes ...


I don't agree to 100%.
The jvm is no interpreter, but a compiler itself.
It compiles the bytecode to specific machine-code.

Therefore we have Just-in-time-compilers, hot-spot-compilers and not hot-spot-interpreters or JIT-interpreters.

Calling Java an interpreted language is propaganda from the C++ - folk
(They still believe java is slow )


http://home.arcor.de/hirnstrom/bewerbung
elysee chung
Greenhorn

Joined: Jul 25, 2004
Posts: 7
Ohter languages
Source code --(compile)--> Object code --(link)--> Executable code (file)

Java
Source code --(javac)----> Bytecode
...........................Bytecode --(JVM)------> Executable code (No real file exist)

So, I think Just-in-time-linker is more correct. is it ?
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by Stefan Wagner:
The jvm is no interpreter, but a compiler itself.
It compiles the bytecode to specific machine-code.


Actually, it is both. It first interpretes the byte code, analyses its runtime behaviour and then starts to compile the most important parts of it to native code in small chunks.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
Originally posted by elysee chung:
According to Java web site
http://java.sun.com/docs/books/tutorial/getStarted/intro/definition.html
Question is

From Java web site
http://java.sun.com/docs/books/tutorial/getStarted/intro/cando.html

The figure (gs5.gif)

Which part is JVM ?
Java HotSpot Runtime ?


Java HotSpot Runtime is the JVM which runs the programs. The Java Plug-in is used for running applets. The classes may be used by the JVM or by the Plug-in.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference between JVM and JRE