我设置的/Users/用户名/.bash_profile下的环境变量为:
export JAVA_HOME=`/usr/libexec/java_home`
export ANDROID_SDK_ROOT="/Users/haziliang/adt-bundle-mac-x86_64/sdk"
export ANT_HOME="/Users/haziliang/opensource/apache-ant-1.9.0"
export PATH=${PATH}:${JAVA_HOME}:${ANDROID_SDK_ROOT}:${ANDROID_SDK_ROOT}/platform-tools:${ANDROID_SDK_ROOT}/tools:/usr/local/mysql/bin:${JAVA_HOME}:${JAVA_HOME}/bin:${ANT_HOME}/bin
ant的build.xml中
<property environment="env" />
<echo message="PATH目录 = ${env.PATH}"/>
打印出来是
[echo] PATH目录 = /usr/bin:/bin:/usr/sbin:/sbin
打印的是系统的环境变量:/etc/profile 对应的/etc/paths里边的内容的一部分,反正就是系统默认的PATH路径.