#!/bin/bash #java environment variables Base_Path=$(cd `dirname $0`; pwd) echo $Base_Path JAVA_HOME=$Base_Path/jdk1.8.0_131 echo $JAVA_HOME JAVA_BIN=$Base_Path/jdk1.8.0_131/bin echo $JAVA_BIN PATH=$PATH:$JAVA_BIN echo $PATH CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar echo $CLASSPATH #cancel LD_LIBRARY_PATH define #LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$Base_Path/lib #echo $LD_LIBRARY_PATH #write java environment variables to /etc/profile if not exist grep -q "export JAVA_HOME" /etc/profile if [ $? -ne 0 ]; then echo "java environment variables not exist,starting define it" echo "export JAVA_HOME="$JAVA_HOME>>/etc/profile echo "export JAVA_BIN="$JAVA_BIN>>/etc/profile echo "export PATH=$PATH:$JAVA_BIN">>/etc/profile echo "export CLASSPATH="$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar>>/etc/profile #echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$Base_Path/lib">>/etc/profile fi echo "Config Java Environment Variables Success" #compile file source /etc/profile #copy lib .so file to /usr/lib for file in $Base_Path/lib/* do #echo $file if test -f $file && [ "${file##*.}" = "so" ]; then echo "copy:"$file cp $file /usr/lib fi done echo "Config .so File Success" #compile .so file ldconfig #copy config.ini file if [ ! -f "/usr/local/config.ini" ]; then cp $Base_Path/lib/config.ini /usr/local echo "cp success" fi echo "Config Success"