I'm just initializing the files with a path to see if they exist.
What exactly do you mean by that? If you're only creating java.io.File objects and you use the method exists() to check if the file or directory exists, you are not opening any files on the file system, and this is not the cause of your problem.
By the way, For readers, there is no flush().
Originally posted by Aruneesh Salhotra:
If you are writing to a file, before you call the file.close(), you should always call, file.flush(), so that any thing in the buffers get written to the file, in the first place.
No. As long as you're closing the same Writer you've been writing to (good practice in general!) this will always happen automatically. BufferedWriter, etc, will call flush() and then close() on their target when you call close() on them.
Originally posted by Nirmal Mekala Kumar:
Thank you guys but cant use System.exit() because my program has to be still running when i close the files. Also i'm not using any I/O streams. I'm just initializing the files with a path to see if they exist. So i cant use the stream close methods.
It sounds like you need to post some code in order to illustrate what you are trying to do. At this point, we can only guess at how to fix the problem, and as you can see, we seem to be guessing incorrectly. The exact code that causes the problem will help clarify what is going on.