Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
281 views
in Technique[技术] by (71.8m points)

scheduling - Run a program or method at specific time in Java

I just want that my program or method should run at specific date and time. i have heard about Timer and TimerTask in java API. But don't know exactly how to use it.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If you want to run a java program at a specific time you probably want to look at the OS tools (like cron or at).

If you want to run a method inside of an already running java application then the ScheduleExecutorService, while it may be overkill, is pretty easy to use.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...