| Author |
Automatic execution of java file using bat or something else
|
Rajeev kumar jha
Greenhorn
Joined: Apr 30, 2008
Posts: 5
|
|
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
|
 |
James Ward
Ranch Hand
Joined: Apr 27, 2003
Posts: 263
|
|
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.
|
 |
Manish Ramrakhiani
Ranch Hand
Joined: Aug 20, 2009
Posts: 44
|
|
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.
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
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.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Rajeev kumar jha
Greenhorn
Joined: Apr 30, 2008
Posts: 5
|
|
Thanks a lot everybody!
Please let me know how to use Windows Scheduler for this purpose.
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
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.
|
 |
 |
|
|
subject: Automatic execution of java file using bat or something else
|
|
|