How to use environment variables in Java with Eclipse? (MAC OS X)
In .bash_profile I have listed many env variables as follows:
export JAVA_HOME=...
export PYTHON=...
...
System.getenv() returns a list of env variables (e.g., SHELL, TMP_DIR) but not t开发者_StackOverflow中文版hose listed in .bash_profile. Where these are coming from and how to get the ones in .bash_profile?
Thanks!
Eclipse takes them from the run configuration. menu Run->Run Configurations...
Select your app, switch to the arguments tab, and put your env variables down there, eg:
-Dname=value
You probably want them in .bashrc instead of .bash_profile. See the INVOCATION section of the bash man page for details of how and when certain init files are loaded.
精彩评论