Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / June 2007

Tip: Looking for answers? Try searching our database.

how does windows find java.exe?

Thread view: 
Martin - 26 Jun 2007 15:09 GMT
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 - 26 Jun 2007 16:05 GMT
> 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.

Signature

Thomas

Roedy Green - 26 Jun 2007 21:00 GMT
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 - 26 Jun 2007 22:26 GMT
: 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\Windows\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 - 27 Jun 2007 07:21 GMT
>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths
>
[quoted text clipped - 11 lines]
>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
Malcolm Dew-Jones - 27 Jun 2007 17:31 GMT
: >HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths
: >
[quoted text clipped - 11 lines]
: >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 - 28 Jun 2007 14:34 GMT
>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.
[quoted text clipped - 3 lines]
>
>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 - 28 Jun 2007 15:45 GMT
> 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.
Signature

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

Martin - 27 Jun 2007 10:06 GMT
> Here is the trick.  They place a spare copy of java.exe in
> C:\Windows\System32\java.exe

Oh....simply and dirty!
Thanks!

JMS
Roedy Green - 28 Jun 2007 13:42 GMT
On Wed, 27 Jun 2007 02:06:48 -0700, Martin
<EdkIlhKpnBbr@spammotel.com> wrote, quoted or indirectly quoted
someone who said :

>> Here is the trick.  They place a spare copy of java.exe in
>> C:\Windows\System32\java.exe
>
>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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.