• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to add a task to Windows Task Schduler using Java?  RSS feed

 
Wei Lu
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I would like to add jobs to Windows Task Scheduler using Java. Is there any API for that? Any suggestion will be appreciated .

Thanks.

Wei
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Windows OS has a program - schtasks.exe - that you can use in a command prompt.

When you have configured a command - and you want to execute it from Java, then you need to look at the Runtime and Process classes.

ProcessBuilder could also be a solution - instead of the Runtime class.
[ September 08, 2008: Message edited by: Rene Larsen ]
 
Campbell Ritchie
Marshal
Posts: 56533
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But before going anywhere near Process look at the classic example about "when Runtime.exec() won't" by Miachael Daconta. It is easy enough to find with Google.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!