JAVA连接远程服务器执行shell脚本启动TOMCAT权限问题

JAVA本地连接远程linux服务器执行shell脚本提示:
Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variable is needed to run this program

注:脚本在服务器可以运行,连接用的也是root账户,是不是权限问题,还是其他,希望哪位高手能帮忙下看看是什么问题。

下面是SHELL脚本的一段代码:
start()
{

echo "============== TOMCAT WILL BE RESTART NOW ==================="
cd /opt/apache/webapps/

    rm -rf test/

    cd /opt/apache-activity/bin/

 ./startup.sh

  echo "STARTING TOMCAT complete.... ...."
    sleep 5

}

没有定义JAVA-HOME或者JRE_HOME环境变量

明显是没有java环境变量,,

自己解决了,脚本里面要重新导入环境变量,也就说服务器设置了环境变量,脚本里面也需要导入引用