How to automatically run java function/program on server
I have written a code to send mail to user and that's running nicely, but this program i want to place on server side and runs continuously without any client interaction. It should be run automatically after spec开发者_如何学编程ific time. When server stops then only it will stop. So can any one help me how to do this...?
Thanks in Advance...
If your server has cron
, you can have the job run at scheduled times. Without knowing more about how the application works, and how it knows when it's time to send an email, there's not much more I can say.
You should look at the Quartz and how to start a java process from the command line in your deployment environment (it's slightly different in Windows and *nix, and very different in z/OS).
If I understood correctly, in your case I would just use the at command. You can find a description in its man page1.
Probably calling at with a calculated time from the moment of execution, and adding that to a rc.d script would do it.
精彩评论