Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to determine the location of an executable (java.exe) on Windows. I know it must exist somewhere in the PATH since I can run it, but I don't know the exact directory that it is being run from. On a UNIX system I could use the whence command to obtain this information. Is there an equivalent command for Windows systems?

share|improve this question
up vote 4 down vote accepted

On my Vista laptop if I type "where java.exe" from the command prompt it gives me the location of java.exe.

Hope this helps.

share|improve this answer
"where" works on Windows 2003 and Win 7 too. Does not appear to be part of XP though. – Chris_K Aug 25 '09 at 15:24
Perfect! Thanks. – An̲̳̳drew Aug 25 '09 at 15:39
where.exe can be copied directly from a 2003 box to an XP box and will work fine there. just do "where where.exe" to locate it! – Le Comte du Merde-fou Aug 25 '09 at 15:40
@mh It's in C:\Windows\System32 on my machine. Running "where where" (no extension is needed) finds it. – An̲̳̳drew Aug 25 '09 at 15:49

Not exactly. You have a few choices:

  • At a command prompt from the root of C: run: Dir /s java.exe
  • install the win32 port of which.exe (there may be a whence.exe port too)
  • use the search functionality in windows explorer
  • get one of several third party windows file indexing and searching utilities
share|improve this answer
The dir /s is a good option; the output can then be cross-referenced with the PATH contents. – An̲̳̳drew Aug 25 '09 at 15:43

Install this: Then open a command prompt and type: which java

share|improve this answer
You may need to add the directory where you installed which to your PATH. – Sean Staats Aug 25 '09 at 15:10

In a command prompt type "path".... that will give you your path you can also use the "find" command.

share|improve this answer

Check out the first Google hit for "equivalent whence windows". You'll have to write a small utility to do it.

share|improve this answer

Here's a "whereis" script from Raymond Chen's blog:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.