• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

execution of application at a specific time

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi i have written a software and when i click on a button "Start", the software is executed automatically and continue to execute till i dnt exit the software. Now i want to write a code that will lauch the appliaction at a specific time e.g @ 08:00 am and stop it @ 08:00 pm. PLEASE HELP ME OUT. thanks in advance
[ February 11, 2007: Message edited by: Bear Bibeault ]
 
author
Posts: 23958
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are using Java 5 and above, then the ScheduledThreadPoolExecutor class is probably what you want. Otherwise, you could also try the Timer class. Both of these support the capability of starting a thread at a particular time.

As for stopping such a thread, I am afraid it will have to be cooperative -- you will need to have your code check, and return, when the finish time arrives.

Henry
 
Ranch Hand
Posts: 1170
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Best approach is to not use Java but to use the facilities of the OS you plan to run on.
 
I'm THIS CLOSE to ruling the world! Right after reading this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic