• 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:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Automatic execution of java file using bat or something else

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have create a java program that is reading a excel present on a specified folder on the system and based on the values , i am calling the stored procedure to update the database.

I need to execute automatically java program periodically.

Any help would be appreciated
 
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Several Approaches:

1. Write a Java Program. Use Timer Class, to invoke your relevant class to do the job periodically. This Java program must run forever. Advantage: Platform neutral solution (windows/linux/...)

2. On Linux, you can use cron job to execute your java program, or write a shell script that does this.

3. On Windows - i would suggest stick to option 1. Windows Scheduler, not too good.
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Writting a Cron Job in java would be the easiest thing I would say.
You need to use the Timer class...

An exapmle "http://www.ibm.com/developerworks/java/library/j-schedule.html" might help you.

Thanks,
Manish Ramrakhiani.
 
Sheriff
Posts: 22684
128
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

James Ward wrote:3. On Windows - i would suggest stick to option 1. Windows Scheduler, not too good.


Can you elaborate? I've used Windows Scheduler quite often, and it hasn't failed me yet.

Granted, I never run complex commands; instead I create a batch file with those complex commands and run that. Still it all works.
 
Rajeev kumar jha
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot everybody!

Please let me know how to use Windows Scheduler for this purpose.
 
Rob Spoor
Sheriff
Posts: 22684
128
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://www.google.com/search?client=opera&rls=en&q=windows+task+scheduler&sourceid=opera&ie=utf-8&oe=utf-8
First two hits are good enough to help you out.
 
You can thank my dental hygienist for my untimely aliveness. So tiny:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic