What's the difference between "JDK" and "JRE"?

B

broli

It seems both have a java.exe which can be used to execute the byte
code(.class) but then jre does not have the javac compiler.
 
S

Sabine Dinis Blochberger

broli said:
It seems both have a java.exe which can be used to execute the byte
code(.class) but then jre does not have the javac compiler.

You basically answered your own question.
 
M

Mark Space

broli said:
It seems both have a java.exe which can be used to execute the byte
code(.class) but then jre does not have the javac compiler.

Pretty much that is it. There are more development tools in the JDK
than just javac, but that's the idea. JRE is just the runtime, for a
user who wants to only run programs other write. The JDK is for
programmers who need more tools, like javac.
 
A

Arne Vajhøj

Mark said:
Pretty much that is it. There are more development tools in the JDK
than just javac, but that's the idea. JRE is just the runtime, for a
user who wants to only run programs other write. The JDK is for
programmers who need more tools, like javac.

It should be noted though that a few server products requires
the JDK just for running, because they use stuff from tools.jar.

Arne
 
R

Roedy Green

It should be noted though that a few server products requires
the JDK just for running, because they use stuff from tools.jar.

Java.exe -server lives in the JDK only.
 
A

Arne Vajhøj

Roedy said:
Java.exe -server lives in the JDK only.

1) No.

C:\Program Files\Java\jre1.6.0\bin>java -?
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)

where options include:
-client to select the "client" VM
-server to select the "server" VM

2) Even though most server apps uses the server VM, then it
is perfectly valid to use server VM for client apps and client
VM for server apps.

Arne
 
R

Roedy Green


A while a go I did benchmarks with client and server. I found that the
JRE version of java.exe did not understand -server.

the system32 version of java.exe might be smart enough to use the JDK
version if you use -server.
 
A

Arne Vajhøj

Roedy said:
A while a go I did benchmarks with client and server. I found that the
JRE version of java.exe did not understand -server.

the system32 version of java.exe might be smart enough to use the JDK
version if you use -server.

As I showed then in the stuff you did not quote, then the java.exe
in my JRE does understand (or at least claim to) -server.

It is also very simple to use fc to verify that the java.exe in the
JRE bin and the JDK bin are identical.

Arne
 
R

Roedy Green

It is also very simple to use fc to verify that the java.exe in the
JRE bin and the JDK bin are identical.

that means little. They look in the registry ,load dlls, figure out
which JDK/JRE to use etc. So the exact same executable can behave
differently in different contexts.

The most obvious example would be using an java.exe in a JRE uses that
JRE where the one in system32 looks in the registry ot decide which
JRE to use then loads that one.
 
R

Roedy Green

As I showed then in the stuff you did not quote, then the java.exe
in my JRE does understand (or at least claim to) -server.

I just did an experiment


[F:\Program Files\Java\jdk1.6.0_05\jre\bin]java -server -jar
E:\com\mindprod\converter\converter.jar

which would have used the jre java.exe and it worked happily. You are
correct. Now the question is, is this behaviour new in 1.6, or was it
always thus and something threw me off earlier.
 
A

Arne Vajhøj

Roedy said:
As I showed then in the stuff you did not quote, then the java.exe
in my JRE does understand (or at least claim to) -server.

I just did an experiment


[F:\Program Files\Java\jdk1.6.0_05\jre\bin]java -server -jar
E:\com\mindprod\converter\converter.jar

which would have used the jre java.exe and it worked happily. You are
correct. Now the question is, is this behaviour new in 1.6, or was it
always thus and something threw me off earlier.

C:\Program Files\Java\jre1.5.0\bin>java -?
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)

where options include:
-client to select the "client" VM
-server to select the "server" VM

C:\Program Files\Java\j2re1.4.2_02\bin>java -?
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)

where options include:
-client to select the "client" VM
-server to select the "server" VM

C:\Program Files\Java\j2re1.4.1_02\bin>java -?
Usage: java [-options] class [args...]
(to execute a class)
or java -jar [-options] jarfile [args...]
(to execute a jar file)

where options include:
-client to select the "client" VM
-server to select the "server" VM

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,034
Messages
2,570,356
Members
47,002
Latest member
RobertoLip

Latest Threads

Top