I would to know how can I schedule a task to be executed every month, I was trying with a method I see on StackOverflow: "http://stackoverflow.com/questions/4107011/java-monthly-timer".
Thank You.
fred rosenberger wrote:my advice: don't.
Java is not really the best tool for this sort of thing. On *nix systems, you'd use cron. on Windows, you'd use a scheduled task.
As my old boss used to say, "Use the right tool for the right job".
Dennis Colossal wrote:
But how can I do it on Windows?
Dennis Colossal wrote:But btw, have no way to do it with Java? It have no support class to make it?
Henry Wong wrote:
Dennis Colossal wrote:But btw, have no way to do it with Java? It have no support class to make it?
Sure.... Java can do this via a scheduled executor, but is it guaranteed to be running? What happens when the machine gets rebooted?
With OS services, those tasks will be running at the requested day and time, as long as the OS is running. The OS will deal with restarts, etc.... Remember that you are talking about months in terms of time frames. Is Java really the preferred option?
Henry
Dennis Colossal wrote:But btw, have no way to do it with Java? It have no support class to make it?
salvin francis wrote:
Dennis Colossal wrote:But btw, have no way to do it with Java? It have no support class to make it?
Java is a programming language. Using java, you can write programs to do any task. A program has to be 'executed'. It can be killed by a user or by the operating system. If a program is no longer running, it simply cannot do your task.
As suggested by others, there are daemons/services which are provided by the operating systems to do repeating tasks. These are special programs which run in the background. Usually, an operating system manages it and ensures that it's always running even after rebooting.
salvin francis wrote:While the SO link has suggested many ways, the discussion here was about feasibility rather than possibility.
Where are you going to run your program ?
What is the error you are facing ? ItDoesntWorkIsUseless