What is the best solution to perform scheduled tasks in Java, whatever the OS?

后端 未结 5 1418
遥遥无期
遥遥无期 2021-02-04 16:31

I\'d like to generate alarms on my Java desktop application :

  • alarms set with a specific date/time which can be in 5 minutes or 5 months
  • I need to be able
5条回答
  •  逝去的感伤
    2021-02-04 17:34

    Bicou: Great that you shared your solution!

    Note that the "schtasks.exe" has some localization issues, if you want to create a daily trigger with it, on an English Windows you'd have to use "daily", on a German one (for example) you'd have to use "täglich" instead.

    To resolve this issue I've implemented the call to schtasks.exe with the /xml-option, providing a temporary xml-file which I create by template.

    The easiest way to create such a template is to create a task "by hand" and use the "export"-function in the task management GUI tool.

提交回复
热议问题