Super User is a question and answer site for computer enthusiasts and power users. 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

Why can't I see java.exe from Cygwin?

Cygwin vs Win8

share|improve this question
up vote 13 down vote accepted

In x64 editions of Windows 8/7/Vista, contents of C:\Windows\System32 folder depend on the bitness of the application .

For 64-bit applications (such as Windows Command Prompt, cmd.exe) there's no filesystem redirection:
C:\Windows\System32 (in software) -> C:\Windows\System32 (on disk).
So, C:\Windows\System32 folder contains 64-bit DLL and EXE files, from the point-of-view of 64-bit application.

For 32-bit applications (such as bash.exe from Cygwin) which runs via WoW64 subsystem on Windows x64, there are two redirections in the filesystem:
C:\Windows\System32 (in software) -> C:\Windows\SysWOW64 (on disk).
C:\Windows\Sysnative (in software) -> C:\Windows\System32 (on disk).
So, C:\Windows\System32 folder contains 32-bit DLL and EXE files, from the point-of-view of 32-bit application.

If you want to access 64-bit applications and DLL files (such as java*.exe) from 32-bit applications (such as Cygwin's bash.exe), you need to use C:\Windows\Sysnative path, or /cygdrive/c/Windows/Sysnative in Cygwin notation.

(this is an updated and extended answer)

share|improve this answer
    
Yes, they are there: Chloe@xps /cygdrive/c/Windows/sysnative $ ls -la java* -rwx------+ 1 SYSTEM SYSTEM 188320 Mar 7 04:43 java.exe – Chloe Mar 8 '13 at 19:56
    
Why does it do that? I can't see sysnative from DOS prompt. – Chloe Mar 8 '13 at 20:00
2  
So, cygwin's bash.exe runs as 32-bit application and in that context C:\Windows\System32 is mapped to C:\Windows\SysWOW64 (a folder without java* files). Windows command prompt (cmd.exe) runs as 64-bit application and so it is able to see true C:\Windows\System32. Use C:\Windows\sysnative to access true system32 directory from 32-bit applications. More information on this topic: msdn.microsoft.com/en-us/library/windows/desktop/… – Mikhail Kupchik Mar 8 '13 at 20:00
    
Wow that is totally backwards and confusing! – Chloe Mar 8 '13 at 20:11
1  
Yes, they should have made \Windows\system64 directory for 64-bit system DLL and EXE files, but unfortunately we have 64-bit files in System32 directory and awkward filesystem redirection. – Mikhail Kupchik Mar 8 '13 at 20:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .