Normally, we started开发者_开发技巧 applications from the terminals(or console), and the terminal which starts the applications will be the standard io of the applications.
If we close the terminals, the applications started by the terminal will normally be closed as well. But for those daemon processes are not closed. My questions is how terminal decides which applications to close, which not? And if I wanna write a daemon application, what shall I do to prevent being closed?
For those applications not closed, what happens if they print out something to the standout. Since the terminal is closed, where will the output go?
Thanks.
Try the Apache JSVC package. It provides a proper executable, which knows how to arrange things in order for a java process to run as daemon under unix. It will also take care of the stdout/err channels, redirecting them into files or whatever you need. For windows, the procrun tool provides the capabilities to run a java VM as standard windows service.
精彩评论