1.修改/etc/profile文件:
export GRAILS_HOME=/home/lm/tools/grails-2.5.1
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
export JRE_HOME=$JAVA_HOME/jre
# export GRAILS_HOME=/home/lm/tools/grails-2.2.4
# export JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64
# export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$GRAILS_HOME/bin:$JAVA_HOME/bin:$PATH
2.控制台执行:
source /etc/profile
使配置立即生效。