• Post Reply Bookmark Topic Watch Topic
  • New Topic

execution of application at a specific time

 
Zaafir Barahim
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • 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 ]
 
Henry Wong
author
Sheriff
Posts: 22518
109
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • 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
 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!