Wednesday, February 22, 2012

Executing a JAR file using Windows Task Scheduler

Generally, when we click over a jar file , it executes. But if we are in need of executing a jar file using Windows Scheduler it invites some barriers(!).
We are not in need to do something incredible, just usingthe Windows Task Scheduler. . We need to customize the various prefrences for setting up the task in the windows scheduler.

Since a JAR file is not a Windows executable file, all you need to do is:

1. Type task in the run from the start menu(for windows 7).
2. from the action panel of the right side of the window, select Create task.
3. Filling all the parameters of General and Trigger panel, from the action panel
Set program or script to the location of java.exe from the specified location of the jre folder.
C:\Program Files\Java\jre6\bin\java.exe
Set add arguments option to something like the command line to execute the jar.
-jar D:\jarFileLocation\jarFile.jar