Let's see your code that's giving problems. Did you use the Thread.sleep method?
Thanks for reply
solved the problem almost .... just need to control the loop because it is an continuous loop
Here is the code:
import java.io.*;
import java.util.*;
class TimerTest extends TimerTask
{
public static void main(String[] args) throws IOException
{
TimerTask tt = new TimerTest();
Timer t = new Timer();
/*while (new BufferedReader(new InputStreamReader(System.in)).read()!='x')
{
t.scheduleAtFixedRate(tt, new Date(),5000);
}*/
t.scheduleAtFixedRate(tt, new Date(),5000);
}
public void run()
{
System.out.println("Timer set for every 5 seconds");
}
}
remove the comments and comment the last line of main() to test the while loop.
Now i'll describe my actual task ...
we have to print documents according to the scheduled time.
That means,
if we select some files and set some time for that file, it should get printed without any manual interference. Setting time like once a day, once every 1 hour and so on....