LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   run java applications on startup (https://www.linuxquestions.org/questions/linux-newbie-8/run-java-applications-on-startup-463035/)

alexandros 07-11-2006 02:00 PM

run java applications on startup
 
hi averybody
I have a problem i have slackware 10 installed on a server and i have a web application that runs on it so i want mysql tomcat and pserver(a server application that i have made) to be run when the pc is starting
i have made a script named rc.pns with the following lines

mysqld_safe --user=root --port=80
cd /root/pserver/
/root/jdk1.5.0_06/bin/java -classpath /root/pserver pserver.PersServer >server.l
/root/jakarta-tomcat-5.5.9/bin/startup.sh

comments
a)i dont care about security this time so i dont care about running mysql as root
b)/root/pserver/ is the path where pserver is installed

and i have putted in rc.M the linew

if [ -x /etc/rc.d/rc.pns ]; then
/etc/rc.d/rc.pns
fi

the problem is that mysql starts fine every time that my pc is starting up but the other two applications does not
I have tried to put every program (mysql, pserver, tomcat) is defferent rc files and put several lines in rc.M for its on of the programs nut i had the same results mysql runs bu the other two does not
Has anybody of you any idea this problem?
is there any problem about starting java applications on startup

bathory 07-12-2006 02:07 AM

Ther problem is that (at least for tomcat) you must define the JAVA_HOME env. varriable before runnig the 2 java apps. So you can modify your script like this:
Code:

mysqld_safe --user=root --port=80
cd /root/pserver/
export JAVA_HOME=/path/to/java
/root/jdk1.5.0_06/bin/java -classpath /root/pserver pserver.PersServer >server.l
/root/jakarta-tomcat-5.5.9/bin/startup.sh

Regards


All times are GMT -5. The time now is 05:11 AM.