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.
You can run your task inside a Glassfish Java EE server. It supports a Timer Service that fires background tasks at specified intervals. When you're running a cluster of Glassfish servers on different machines, they'll collaborate to fire the task exactly once.
A simpler approach is to rely on cron for Unix systems. At specified times you can run your java task via the java command.
I've also used pycron on Windows, which is a service that emulates cron.