Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-07-2008, 07:13 AM
Member
 
Join Date: Aug 2008
Posts: 8
Rep Power: 0
Farzaneh is on a distinguished road
Default writing a program launcher (or Timer)
Hi all,
I should write a program for launching another program.
The launcher should launch the main program at a specific time and date, and stop it in another specific time and date.This operation should be repeated every day or weak or month. Time and date and periods are set by user.
I don't have any clue on how to write such a program in Java.
Is this possible with java? Could some one help me and say how to do this? or if someone has a similar code?

Thanks
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 09-07-2008, 08:49 PM
Nicholas Jordan's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Southwest
Posts: 1,018
Rep Power: 3
Nicholas Jordan is on a distinguished road
Exclamation use chron
Originally Posted by Farzaneh View Post
.....Is this possible with java? Could some one help me and say how to do this? or if someone has a similar code?
Scheduling on an in program while running has basis Timer and TimerTask which will do that, but on trying to do that myself I was advised by ftr who knows what he is doing to use chron, which is a system level utility. In general, such a task would be a system level task, and therefore should be done with utilities written for that purpose. As well, such utilities have been in use and that provides great proveability / reliability.

Is this a student project?... If so, there will be avenues of arriving at the design available. If it is commercial, there may be limitatioins that hinder reliability.

message edit: cron
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
.
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

Last edited by Nicholas Jordan; 02-18-2009 at 04:21 AM. Reason: cron
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 02-17-2009, 06:26 AM
Member
 
Join Date: Jun 2008
Posts: 4
Rep Power: 0
Hassan Hafez is on a distinguished road
Default
This method execute a program (a cmd code) and return it's process, so you can close it when you want.

Runtime.getRuntime().exec(code);
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 02-17-2009, 09:00 AM
Member
 
Join Date: Feb 2009
Posts: 7
Rep Power: 0
l_m_b is on a distinguished road
Default
Maybe Nicholas meant "cron" instead of "chron"

Whatever...

There is a wonderful example for using Timer/TimerTask at ibm's site. Just google by "j-schedule" and you will find it (I'm still not able to submit links here which is very irritating ).

You can also have a look at some open-source java schedulers like "quartz".
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how begin with writing a new program ? dimitrist New To Java 11 05-13-2008 03:49 AM
How to cancel an individual timer in spite of canceling whole timer Java Tip java.util 0 04-04-2008 02:46 PM
Timer usage in java program sandeeprao.techno New To Java 5 01-24-2008 07:16 PM
Help needed writing a program... Francis New To Java 2 11-22-2007 02:03 PM
writing to a excel file from java program priyankabhar New To Java 1 07-10-2007 08:05 PM


All times are GMT +2. The time now is 02:38 PM.



VBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org