• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Difference between JVM and JRE

 
elysee chung
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, stupid question!
What is the difference between JVM and JRE ?
 
Ben Buchli
Ranch Hand
Posts: 83
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>>> "JVM is included in JRE and runs your code. "

Why use JRE not JVM ?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
elysee chung
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, If we want to run Java program, we should install JRE not JVM ?

(Java program run on JRE only!)
 
Marilyn de Queiroz
Sheriff
Posts: 9059
12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you should install the JRE (which contains the JVM) and not install only the JVM.
 
Robert Konigsberg
Ranch Hand
Posts: 172
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you trying to solve a larger problem, or are you just interested?
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think you even *can* install the JVM seperately, can you?
 
Ken Okoli
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
elysee chung
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 83
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1923
Linux Postgres Database Scala
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 )
 
elysee chung
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9059
12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic