Command not found

On my MAC - I get Command not found error for some command like mvn , java_home etc .

I CD to the actual directory to take path out of picture and even then i get the command not found error .

anyone else have the same problem ?

The programs you are trying to execute there are not part of your PATH.
Add the directory that contains them to your PATH, and then, if those programs are marked as executable you can just use the name of the program.

Example:
myprogram lives in ~/ambm01/myprogram

$PATH=$PATH:~/ambm01
export PATH

Now you can issue, the command

myprogram

java_home is normally an environment variable in uppercase (JAVA_HOME) and not a program.

Here is what I am doing

cd /usr/libexec

ls

<I see java_home > no I am not referring to env variable $JAVA_HOME . This java_home in this directory tells which jdk are you pointing to.

i type java_home ..i get

-bash: java_home: command not found

my path= /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

but since I am in the actual directory where the program is located , why would I get command not found .

---------- Post updated at 11:09 PM ---------- Previous update was at 11:00 PM ----------

Nevermind - had to append ./

Thanks for asking.

Since the current directory (dot) is not in the PATH (which it shouldn't be for security concerns) you need to tell it where it is by appending the ./ in front.

1 Like