How to set ANT_HOME on Ubuntu Desktop 12.04?

前端 未结 6 1614
时光取名叫无心
时光取名叫无心 2021-02-09 08:12

It looks like Ubuntu uses ~/.bashrc, ~/.bash_profile, ~/.pam_profile, /etc/environment, and /etc/profile in very

6条回答
  •  一向
    一向 (楼主)
    2021-02-09 09:06

    Firstly, it's standard practice to omit the trailing slash when setting env variables on *nix. (You have a trailing slash at the end of yours). So you should write:

    export ANT_HOME=/opt/apache/ant/1.8.4/apache-ant-1.8.4

    ... and not:

    export ANT_HOME=/opt/apache/ant/1.8.4/apache-ant-1.8.4/

    ~/.bashrc, ~/.bash_profile are good if you only care about your user account and you use the bash shell. For setting an environment variable, it doesn't really make much difference which of these you use. .bashrc would reset it every time you opened a new shell, whereas .bash_profile would reset it every time you logged-in.

    The files in /etc would set it for all users on your system (but it could be overridden locally). If you're going to have different users building and you want them all to have the same environment varilables, then /etc/profile would be a good place to put it.

提交回复
热议问题