JRE vs. JDK question

  • Thread starter =?ISO-8859-1?Q?Arne_Vajh=F8j?=
  • Start date

?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

David said:
I've started some Java development on Windows and I have a question I
was hoping someone could tackle. It's a bit complicated, so please bear
with my explanation:

I am using the 1.5 JDK, which I installed in C:\program files\java. Also
in that directory is the 1.6 jre folder, which was installed
automatically when I hit a webpage that had a java applet in it. The 1.5
JDK directory is in my PATH environment variable, and when I run javac
from the command line, the executable file that winds up being used is
the one in the 1.5 JDK/bin directory. I've been able to confirm this.

But, when I run the java command, i.e.

java MyProgram

how is it determined whether the java.exe file being used is the one in
the JDK folder, or the one in the jre folder? Similarly, which virtual
machine file(s) are used, and how is it determined?

If you want to control it then you put the proper dir in PATH.

The installers copy java.exe to a windows dir, so if you do not
put a dir in PATH, then java.exe in a windows dir from the last install
will be used.

Arne
 
Ad

Advertisements

D

David

I've started some Java development on Windows and I have a question I
was hoping someone could tackle. It's a bit complicated, so please bear
with my explanation:

I am using the 1.5 JDK, which I installed in C:\program files\java. Also
in that directory is the 1.6 jre folder, which was installed
automatically when I hit a webpage that had a java applet in it. The 1.5
JDK directory is in my PATH environment variable, and when I run javac
from the command line, the executable file that winds up being used is
the one in the 1.5 JDK/bin directory. I've been able to confirm this.

But, when I run the java command, i.e.

java MyProgram

how is it determined whether the java.exe file being used is the one in
the JDK folder, or the one in the jre folder? Similarly, which virtual
machine file(s) are used, and how is it determined?

Thanks folks.

David
 
Ad

Advertisements

M

Mike Schilling

David said:
I've started some Java development on Windows and I have a question I was
hoping someone could tackle. It's a bit complicated, so please bear with
my explanation:

I am using the 1.5 JDK, which I installed in C:\program files\java. Also
in that directory is the 1.6 jre folder, which was installed automatically
when I hit a webpage that had a java applet in it. The 1.5 JDK directory
is in my PATH environment variable, and when I run javac from the command
line, the executable file that winds up being used is the one in the 1.5
JDK/bin directory. I've been able to confirm this.

But, when I run the java command, i.e.

java MyProgram

how is it determined whether the java.exe file being used is the one in
the JDK folder, or the one in the jre folder?

Like any other executable run from a command line, what determines which
java.exe to run is your PATH. Whichever java.exe that runs uses the JRE/JDK
files in its directory tree, so it will use its own version of, say, the
classes in rt.jar.

The simplest way to check which version this is is "java -version".
 

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

Top