• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

suggestion ways of setting up a cron on windows plateform

 
Ranch Hand
Posts: 42
Android Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a requirement to setup a cron on windows plateform. Cron application that I have built is purely in java and that internally uses workflow system using spring. It has main method which starts the workflow. Now, I want to start this application automatically at some time as set.

This can be done by:

1. Create a bat file for running main method. (jar filename.jar) jar has main class name entry in manifest file. Next set this bat file in windows scheduled task to schedule this at some time.

2. Create a web application. Create a servlet and call the same main class from servlet. Configure the servlet on server startup by adding an entry in web.xml load-on-startup tag. To reschedule again after some interval, use java timer task class or some tool like cron4j.

Could you please suggest which one is better approach. Is there any other approach to do this whole cron activuty. My java application basically does some database operation, refreshes some cache, create xml file, validates it and then send email.
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You might want to check out quartz
 
nazzy khan
Ranch Hand
Posts: 42
Android Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Maneesh,

Thanks for your reply. If I'm not wrong, with quartz I can write unix like expressions and can schedule classes but my main class needs to be started once by some mechanism.

What I'm looking for is some tool similar like crontab in unix which can directly start my java program (by invoking bat file). Further execution I can either use tool's cron feature or Cron4J/Quartz scheduling mechansim or simply by Java TimerThread and Timer task.

As Quartz or Cron4J both are purely in Java, so initially first call has to be from outside like windows scheduled task.

I have got few cron tool similar to crontab in unix like pycron, CRONw or 'AT' command on windows.

Have you came across any such/similar tool which is widely used on windows plateform to schedule jobs and can run as windows service.

Thanks!
 
Sheriff
Posts: 67645
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Windows Scheduler?
 
nazzy khan
Ranch Hand
Posts: 42
Android Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks.. I'm now using the same way

Regards,
Nazzy
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic