I created a task in task scheduler on Windows 7 system and made it repeatable every 10 minutes.
In program, i selected the executable java jar file. But it does not run the jar file at the scheduled time.
When i double click and run the jar file, it runs as desired. The Jar just pops up a dialog box.
Any inputs as to where i am going wrong is appreciated.
Firstly make sure Java is set in the enviroment
PATH
by openingcmd.exe
and typingjava -version
. If you get back the java version, then you are fine. (If not see Update the PATH Environment Variable (Microsoft Windows))Then create a text file, save it as
run.bat
and type inside:Make sure the
bat
is in the same directory as yourjar
file.Now go in Windows Task Scheduler > Create Basic Task > ... >Start a program > and browse for your
.bat
file.Also, set Start in to the path where your
.bat
and.jar
are located. Create your task and it should run fine afterwards.Edit: To avoid the shell being visible a simple trick is to create a VBS file
Create a run-invisible.vbs, and type:
And schedule that instead of the bat (make sure you update the path to your bat in the vbs file)