Results 1 to 4 of 4
  1. #1
    Farzaneh is offline Member
    Join Date
    Aug 2008
    Rep Power

    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?


  2. #2
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Rep Power

    Exclamation use chron

    Quote 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
    Last edited by Nicholas Jordan; 02-18-2009 at 04:21 AM. Reason: cron
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  3. #3
    Hassan Hafez is offline Member
    Join Date
    Jun 2008
    Rep Power


    This method execute a program (a cmd code) and return it's process, so you can close it when you want.


  4. #4
    l_m_b is offline Member
    Join Date
    Feb 2009
    Rep Power


    Maybe Nicholas meant "cron" instead of "chron" ;)


    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 :mad:).

    You can also have a look at some open-source java schedulers like "quartz".

Similar Threads

  1. writing to a excel file from java program
    By priyankabhar in forum New To Java
    Replies: 15
    Last Post: 01-17-2014, 12:39 PM
  2. how begin with writing a new program ?
    By dimitrist in forum New To Java
    Replies: 11
    Last Post: 05-13-2008, 03:49 AM
  3. Replies: 0
    Last Post: 04-04-2008, 02:46 PM
  4. Timer usage in java program
    By sandeeprao.techno in forum New To Java
    Replies: 5
    Last Post: 01-24-2008, 07:16 PM
  5. Help needed writing a program...
    By Francis in forum New To Java
    Replies: 2
    Last Post: 11-22-2007, 02:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts