How to "do something" at a specific time and day of the week in java?

I have an application that should periodically play back some specific audio files (mp3). Let me give you one example: every Monday at 8:00 -> hello.mp3. How can I do this in Java? I am trying to use Calendar, JodaTime, but I cannot do this.

+3
source share
4 answers

It depends if you use Java EE, you can use EJB Timer. And there is always Quartz http://www.quartz-scheduler.org/

+7
source

, , - . Timer . ,

+1

, Timer , Quartz Scheduler - ( ) use), cron- .

Spring , , .

0

java.util.Timer java.util.TimerTask . Quartz.

Spring, ( Quartz Scheduler, java.util.Timer ).

If you run the desktop application, the easiest way is to use java.util.Timer. For more complex schedules, use the Quartz Scheduler.

0
source

Source: https://habr.com/ru/post/1755317/


All Articles