开发者

How to use Java to register a task with the Windows task scheduler?

开发者 https://www.devze.com 2023-01-20 19:50 出处:网络
I have a Java app runs on Win7, it does something at start and goes to sleep for an hour, then wakes up to do more things after the hour, but Win7 goes into sleep mode after 15 minutes of inactivity,

I have a Java app runs on Win7, it does something at start and goes to sleep for an hour, then wakes up to do more things after the hour, but Win7 goes into sleep mode after 15 minutes of inactivity, so I wonder if I can register a task with the Windows task scheduler in my Java app before it goes into thread sleep, so that Win7 will wake up 59 minutes after the Java app goes into sleep, then 1 minute after windows wake up, my Java app will wake up to do its thing.

So is registering a task wit开发者_JS百科h the Windows task scheduler doable in Java ? I only care about running it in Win7. Not Unix or Mac. If so any sample code ?


schtasks then make use of org.life.java post on executing a cmd

0

精彩评论

暂无评论...
验证码 换一张
取 消