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

schedule method in timer class

 
Greenhorn
Posts: 20
Netbeans IDE Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does the method :



schedule a task for execution only once or does it schedule the task for execution repeatedly on the specified date and time?
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does the javadoc say ?
What happened when you tried it ?
 
Joel Bijapurkar
Greenhorn
Posts: 20
Netbeans IDE Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The javadoc says that when we use the schedule(Timer task, Date time) function the specified task is scheduled for execution but does not explicitly mention if the task will be executed once or repeated. I tried it and it works as long as the NetBeans IDE is running.

When I close the IDE I get the following notification:

Exiting the IDE will close the following processes:
Process- Timer(run)

What should I do so that the program continues execution even after closing the IDE?

Here is the code I have created:



Thank you.
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

What should I do so that the program continues execution even after closing the IDE?


The Java process used to run your application is a sub-process of the IDE, so when you close the IDE all of its sub-processes are closed and your application stops. If you want your app to run independently of the IDE you should run the application from the command prompt rather than from the IDE.
 
Joel Bijapurkar
Greenhorn
Posts: 20
Netbeans IDE Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Steve. I found the solution. It is just as you said run the application from the command prompt. But in this case since I wanted to schedule the file for execution at a future time and date, I used a batch file. with the following code:



I then scheduled it using the windows scheduler and the following command:


and its working perfectly.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic