Home » Java » Java Timer TimerTask Example Java java.util.Timer is a utility class that can be used to schedule a thread to be executed at certain time in future. Java Timer class can be used to schedule a task to be run one-time or to be run at regular intervals. If you have a .BAT file and you’re trying to get it to run automatically using Task Scheduler in Windows, you might have run into the issue where it simply doesn’t run unless you manually run the task. I created a batch file that deletes everything inside a temp folder whenever the computer starts up.
Schedule a java program. I have written a java socket server program which listens to a port continuously. It creates a new text file for the incoming data but I want to create a new text file every 30 mins. Schedule Via Java. Use a ScheduledExecutorService and the method scheduleAtFixedRate with a TimeUnit of Day. Your program will wait a day and then do what it has to do. Of course your computer has to be on. If that is an issue, it might be better do something like this using Google App Engine.