For Programmers: Free Programming Magazines  


Home > Archive > Java Help > June 2007 > how does windows find java.exe?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author how does windows find java.exe?
Martin

2007-06-26, 10:10 pm

How does windows find java.exe if I type "java" in the command line
and if java.exe is not in the path?

I know that there is a registry key HKEY_LOCAL_MACHINE\SOFTWARE
\JavaSoft\Java Runtime Environment but I guess windows does not know
about it.

JMS

Thomas Fritsch

2007-06-26, 10:10 pm

Martin wrote:
> How does windows find java.exe if I type "java" in the command line
> and if java.exe is not in the path?

I bet java.exe *is* in your path.
On my system Java-setup has installed a copy of java.exe in directory
"C:\windows\system32\", and "C:\windows\system32\" is part of the PATH
environment variable.
>
> I know that there is a registry key HKEY_LOCAL_MACHINE\SOFTWARE
> \JavaSoft\Java Runtime Environment but I guess windows does not know
> about it.


--
Thomas
Roedy Green

2007-06-26, 10:10 pm

On Tue, 26 Jun 2007 07:09:41 -0700, Martin
<EdkIlhKpnBbr@spammotel.com> wrote, quoted or indirectly quoted
someone who said :

>How does windows find java.exe if I type "java" in the command line
>and if java.exe is not in the path?
>
>I know that there is a registry key HKEY_LOCAL_MACHINE\SOFTWARE
>\JavaSoft\Java Runtime Environment but I guess windows does not know
>about it.


There is a way of putting any file no matter where it is, on the path
by creating a registry entry. See
http://mindprod.com/jgloss/registry.html

However, that is not how Sun did it.

Further, they did not add the JRE path to the execution path.

Here is the trick. They place a spare copy of java.exe in
C:\Windows\System32\java.exe

which IS on the path. It starts up, looks in the registry to figure
out the official java.exe. then starts that.

See http://mindprod.com/jgloss/registry.html
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Malcolm Dew-Jones

2007-06-26, 10:10 pm

Roedy Green (see_website@mindprod.com.invalid) wrote:


: There is a way of putting any file no matter where it is, on the path
: by creating a registry entry. See
: http://mindprod.com/jgloss/registry.html

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Wi
ndows\CurrentVersion\App Paths

but I don't think that is quite the same putting it on the path.

The registry entry makes them visible to the START command, as in

C:> START program-not-in-PATH-but-is-in-REGISTRY.exe


But if you simply type the name of a command as in

C:> PROGRAM.exe

then it must be either in the current directory or in a directory listed
in the PATH environment variable. (Though some entries in the registry do
control which directories are listed in each user's PATH variable.)

$0.10
Roedy Green

2007-06-27, 8:10 am

On 26 Jun 2007 14:22:42 -0800, yf110@vtn1.victoria.tc.ca (Malcolm
Dew-Jones) wrote, quoted or indirectly quoted someone who said :

> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Wi
ndows\CurrentVersion\App Paths
>
>but I don't think that is quite the same putting it on the path.
>
>The registry entry makes them visible to the START command, as in
>
> C:> START program-not-in-PATH-but-is-in-REGISTRY.exe
>
>
>But if you simply type the name of a command as in
>
> C:> PROGRAM.exe
>
>then it must be either in the current directory or in a directory listed
>in the PATH environment variable. (Though some entries in the registry do
>control which directories are listed in each user's PATH variable.


IIRC I have added programs to the App Paths and then I can invoke them
with just xxxx on the command line in 4NT. Don't recall about
xxxx.exe.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Martin

2007-06-27, 8:10 am

> Here is the trick. They place a spare copy of java.exe in
> C:\Windows\System32\java.exe


Oh....simply and dirty!
Thanks!

JMS

Malcolm Dew-Jones

2007-06-27, 10:09 pm

Roedy Green (see_website@mindprod.com.invalid) wrote:
: On 26 Jun 2007 14:22:42 -0800, yf110@vtn1.victoria.tc.ca (Malcolm
: Dew-Jones) wrote, quoted or indirectly quoted someone who said :

: > HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Wi
ndows\CurrentVersion\App Paths
: >
: >but I don't think that is quite the same putting it on the path.
: >
: >The registry entry makes them visible to the START command, as in
: >
: > C:> START program-not-in-PATH-but-is-in-REGISTRY.exe
: >
: >
: >But if you simply type the name of a command as in
: >
: > C:> PROGRAM.exe
: >
: >then it must be either in the current directory or in a directory listed
: >in the PATH environment variable. (Though some entries in the registry do
: >control which directories are listed in each user's PATH variable.

: IIRC I have added programs to the App Paths and then I can invoke them
: with just xxxx on the command line in 4NT. Don't recall about
: xxxx.exe.

This is XP, and so far it still doesn't work for me, I can't run programs
already listed there (except using START) with or without the extension.

The existing entries are keys, so I added a string value directly at that
level, but that didn't work either, even after logout and login.

Perhaps there's some other setting that must be toggled to enable this.

Roedy Green

2007-06-28, 8:09 am

On Wed, 27 Jun 2007 02:06:48 -0700, Martin
<EdkIlhKpnBbr@spammotel.com> wrote, quoted or indirectly quoted
someone who said :

>
>Oh....simply and dirty!
>Thanks!


Sun is going to use methods easy to port with minimal changes to
different OS's, not necessarily the slickest for any given OS.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Roedy Green

2007-06-28, 10:09 pm

On 27 Jun 2007 09:26:36 -0800, yf110@vtn1.victoria.tc.ca (Malcolm
Dew-Jones) wrote, quoted or indirectly quoted someone who said :

>This is XP, and so far it still doesn't work for me, I can't run programs
>already listed there (except using START) with or without the extension.
>
>The existing entries are keys, so I added a string value directly at that
>level, but that didn't work either, even after logout and login.
>
>Perhaps there's some other setting that must be toggled to enable this.


I have done some research on this. It turns out we are both right in
our observations.

See http://mindprod.com/jgloss/registry.html#AUXPATH

You might also find interesting:
http://mindprod.com/jgloss/registry.html#JAVAFIND
on how Java finds its various executables.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Real Gagnon

2007-06-28, 10:09 pm

> I have done some research on this. It turns out we are both right in
> our observations.
>
> See http://mindprod.com/jgloss/registry.html#AUXPATH


AppPath entries are very useful. You can set a specific PATH for an
executable without modifying the global system PATH.

Bye.
--
Real Gagnon from Quebec, Canada
* Java, Javascript, VBScript and PowerBuilder code snippets
* http://www.rgagnon.com/howto.html
* http://www.rgagnon.com/bigindex.html
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com