3

Installed Java 1.7 on Windows Server 2008. In Cygwin I can clearly see that "which java.exe" returns c:\Windows\System32\ even running "java -version" returns 1.7. But on Windows command prompt and/or Powershell it complains it is not a recognized internal or external command.

Nor I can see the file in Windows explorer in the above mentioned path. Even after changing folder options in Windows explorer.

The Java version installed is 64-bit on Windows Server 2008. It is a ditto behavior on Window 7 as well.

Does anyone know how to fix this issue?

Thank you in advance for any help.

-RG

1

4 Answers 4

3

I believe this is because your OS is 64 bits, but your installed version of Java is 32-bits. A 32-bit shell (Cygwin's bash or in my case MSYS' sh) can see and run it, but a 64-bit shell (cmd) cannot.

Sign up to request clarification or add additional context in comments.

6 Comments

Don't they say that their java version is 64 bit?
The OP stated that its OS is 64-bits. But nothing prevents you (or me for that matter...) from installing a 32-bits Java. If you don't extend your CMD path with 32-bit Java folder, CMD will not find it. This is because a plain 32-bits java installation creates a java.exe in c:\Windows\SYSWoW64, that 32-bits applications transparently access as c:\Windows\System32... (a "feature" called File System Redirector[1]). 64-bits applications access the "real" c:\Windows\System32, where no such java.exe exists. [1]:msdn.microsoft.com/en-us/library/windows/desktop/…
Very true, but OP states The Java version installed is 64-bit on Windows Server 2008. It is a ditto behavior on Window 7 as well.
I missed that bit, sorry. Yet, all the symptoms are consistent with the OP having installed a 32-bit Java on its 64-bit OS. It may help resolve the issue if the OP could determine (using Windows Explorer) whether a java.exe exists in c:\Windows\SYSWoW64.
Yes. I do see java.exe in c:\windows\syswow64. Is there a option on java.exe that will tell me whether it is 32 or 64 bit. From above explaination from user2195045 it appears that I have 32-bit installed, it is partly because java/com/en/download/chrome.jsp does not give me an option to choose binary. So could it be that I have 32-bit chrome browser which lead java site to redirect me to 32-bit download...
|
3

Try to use cygwin64, or put %JAVA_HOME%\bin at the start of PATH environment variable.Because https://superuser.com/questions/563016/why-is-java-exe-not-visible-from-cygwin-but-is-visible-from-command-prompt

Comments

1

You might have to set your environmental variables to point to your JAVA installation.

http://java.com/en/download/help/path.xml

2 Comments

I had used Java installer which sets the JAVA_HOME variable plus Java was installed in C:\Windows\System32 which is by default available in %PATH% environment variable. I still don't know why I can't run Java from Windows command prompt. I gave up on that and instead launch java (or .jar programs from Cygwin window.) This behavior I have only seen in Windows Server 2008. The same Java installation on Windows 7 behaves normal. Still open to hear any one's solution.
@RgGlpj Post what your %PATH% variable is exactly.
0

I know this question is old but I needed the answer and didn't find it here so I will provide it for others:

Enter the variable value as the installation path for the Java Development Kit. If your Java installation directory has a space in its path name, you should use the shortened path name (e.g. C:\Progra~1\Java\jre6) in the environment variable instead.

Icon Note for Windows users on 64-bit systems

Progra~1 = 'Program Files' Progra~2 = 'Program Files(x86)'

Source of answer came from atlassian.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.