#!/bin/bash
#write java path
#write java path
echo "ADD file"
echo "" >>/etc/profile
echo 'JAVA_HOME=/usr/java/jdk1.6.0_20' >>/etc/profile
echo 'JRE_HOME=$JAVA_HOME/jre' >>/etc/profile
echo 'PATH=$JAVA_HOME/bin:JRE_HOME/bin:$PATH' >>/etc/profile
echo 'CLASSPATH=.:$JAVA_HOME/lib/jt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib' >>/etc/profile
echo 'export JAVA_HOME JRE_HOME PATH CLASSPATH' >>/etc/profile
echo "" >>/etc/profile
echo 'JAVA_HOME=/usr/java/jdk1.6.0_20' >>/etc/profile
echo 'JRE_HOME=$JAVA_HOME/jre' >>/etc/profile
echo 'PATH=$JAVA_HOME/bin:JRE_HOME/bin:$PATH' >>/etc/profile
echo 'CLASSPATH=.:$JAVA_HOME/lib/jt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib' >>/etc/profile
echo 'export JAVA_HOME JRE_HOME PATH CLASSPATH' >>/etc/profile
. /etc/profile
java -version
java -version
JAVA_HOME=/usr/local/java/jdk1.6.0_22
JRE_HOME=$JAVA_HOME/jre
PATH=$JAVA_HOME/bin:JRE_HOME/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/jt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export JAVA_HOME JRE_HOME PATH CLASSPATH
JRE_HOME=$JAVA_HOME/jre
PATH=$JAVA_HOME/bin:JRE_HOME/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/jt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export JAVA_HOME JRE_HOME PATH CLASSPATH
本文转自 liang3391 51CTO博客,原文链接:http://blog.51cto.com/liang3391/769252