I've got a /etc/init.d/tomcat1
script which runs on boot on rc levels 3 and 5. This script calls /usr/local/tomcat1/bin/startup.sh
on start.
Although I can manually execute /usr/local/tomcat1/bin/startup.sh
from console, on boot I get the following in /var/log/boot.msg
:
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
After that I added the following in /etc/init.d/boot.local
:
export JAVA_HOME="/usr/local/java"
But I still get the same message about JAVA_HOME
missing.
What I ended up doing is modifying /usr/local/tomcat1/bin/catalina.sh
and hardcoding the following:
JAVA_HOME="/usr/local/java"
Tomcat now does start on boot but I know that hardcoding this in the catalina.sh script is not good.
So the question is, how can I set/export JAVA_HOME
so that it's readable from scripts running on boot?
thanks