Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Sir I have an ERP, which runs catalina on tomcat. to run this i need java to be installed. Now my JAVA_HOME is usr/bin/java but i have a script which i want to run on boot. to do that i added the file in rc.local. but when the system boots it says JAVA_HOME variable needs to be declared. for that program it uses java from a different location.

for example: i need to run the file from: /home/ambee/jakarta/ to run this file i need to show the java_home to: /home/ambee/jakarta/java but the system doesn't look for that on booting it goes to the default location of /usr/bin/java

Please give me a solution if possible.


share|improve this question

Add export JAVA_HOME="/usr/bin/java" to the top of the file if you must use your script in rc.local,

A better alternative is to add . /path/to/ in the /etc/init.d/tomcat script under the start call, this literally includes your sh script.

From there just run with chkconfig tomcat5 on to start the services post boot.

Note however updates to tomcat that update the init.d script may break this change and you will want to move your script out of a home directory and into somewhere like /usr/share

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.