Java doesn't really do daemon processes, just threads.
To create a deamon process that is a Java application, write a launching program in C
(or other language of choice) which becomes a daemon (disassociate from a controlling
terminal, close stdin,stdout,stderr)
then exec the java application, ie:
Here are the steps to become a daemon:
pid = fork(); // if your are the parent process exit, child continues
if ((pid) != 0) exit(0);
setsid(); // start new session group with no controlling terminal
pid = fork(); // again parent exits, child continues
if ((pid) != 0) exit(0);
chdir("/");// be nice to the system so we don't tie up any directories
close(0); // close stdin
close(1); // close stdout
close(2); // close stderrr
You're now a daemon, so exec the java application, i.e.:
execl("/usr/bin/java", "java", "myclass", (char *)0);
Your java application will now be a daemon.
Tai
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com