emacs - environment variables
If you run a shell command in eshell
(e.g. java --version
) and if you notice an error that you are not seeing in regular shells (like bash or zsh), it indicates that
Emacs shell is working in a different environment from the one you have at the terminal command line. Compare the output of env when run inside the Emacs shell and when run in the terminal. Pay particular attention to the values of
PATH
.
How to fix this?
Emacs: Environment Variables: http://xahlee.info/emacs/emacs/emacs_env_var_paths.html
According to the article above, if you launch emacs from a shell, it will inherit the shell’s environment variables. Therefore, just launch emacs from whatever shell you are most comfortable with to automatically set the environment variables.
Reference: https://stackoverflow.com/questions/4393628/emacs-shell-command-not-found