Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Use thread to check for file exists. How?

807607Jan 15 2007 — edited Jan 15 2007
public class FileSearcher extends Thread
{
	String name = "Unknown";
	//RunFileSearcher rfs = new RunFileSearcher(name);
	//FileSearcher rfs = new FileSearcher(name);
	File f = new File();
			
	Thread t = new Thread(); // create  the thread
	t.start(); // start the thread running
		
	public void run(name)
	{
		if( f.exists(name) )
		{
			System.out.println("*** File " + f + " has been created. ***");
		}
		else
		{
			System.out.println("Searching for file " + f) ;
		}
	}	
}
How do I use each thread to check for each file exists per sec??
Please Help Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 12 2007
Added on Jan 15 2007
1 comment
101 views