Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java.exe not found on Windows command prompt

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

like image 419
Rg Glpj Avatar asked May 11 '26 14:05

Rg Glpj


2 Answers

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.

like image 103
user2195045 Avatar answered May 14 '26 03:05

user2195045


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

like image 31
zombielei Avatar answered May 14 '26 03:05

zombielei