Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Bash shell can't find java.exe

Tags:

git-bash

Trying to execute java.exe and getting the lovely error

>> sh.exe": java.exe: command not found

The command works in a normal command shell.

I've checked the path of both and they are the almost the same, bash has a few extra directories as expected. I used env |grep PATH and set PATH respectively to check...

where java.exe

C:\Windows\System32\java.exe

set PATH
Path=C:\Ruby193\bin;C:\Windows\system32;C:\Windows;

env |grep PATH
HOMEPATH=\
PATH=/c/Users/hooksc/bin:.:/usr/local/bin:/mingw/bin:/bin:/c/Ruby193/bin:/c/Windows/system32:/c/Windows:

I figure I'm missing something subtle, anyone have any ideas what?

I have snippet the path short to make it a bit easier to read... However, at least 1 of the source folders for java.exe is in the path.

like image 996
Shire Avatar asked Dec 22 '25 10:12

Shire


1 Answers

Gitbash looks for %PATH% variable. On your gitbash type:

env | grep PATH

and check if it contains the path to your jdk's bin directory. If it doesn't, then you'd have to add the path yourself. For more information on how to add it, follow this link: http://www.java.com/en/download/help/path.xml

like image 182
Sun Avatar answered Dec 24 '25 09:12

Sun



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!