The first method:
Can be added in/etc/profile
#java环境变量
Java_home=/home/harries/develop/jdk1.6.0_23
Export JRE_HOME=/HOME/HARRIES/DEVELOP/JDK1.6.0_23/JRE
Export classpath=.: $JAVA _home/lib: $JRE _home/lib: $CLASSPATH
Export path= $JAVA _home/bin: $JRE _home/bin: $PATH
#glassfish环境变量
Glassfish_home=/home/harries/develop/glassfish
Path= $PATH: $GLASSFISH _home/bin
Export PATH Glassfish_home
The second method of
Add java.sh and glassfish.sh to the/etc/profile.d/folder
#vi java.sh
Java_home=/home/harries/develop/jdk1.6.0_23
Export JRE_HOME=/HOME/HARRIES/DEVELOP/JDK1.6.0_23/JRE
Export classpath=.: $JAVA _home/lib: $JRE _home/lib: $CLASSPATH
Export path= $JAVA _home/bin: $JRE _home/bin: $PATH
#vi glassfish.sh
Glassfish_home=/home/harries/develop/glassfish
Path= $PATH: $GLASSFISH _home/bin
Export PATH Glassfish_home
Add execute permissions to java.sh and glassfish.sh
chmod +x java.sh
chmod +x glassfish.sh
When you are done, you should exit the terminal and log back in to make the environment variable effective.
Linux systems add Java and GlassFish environment variables