Reputation: 4447
I try to open a large number of files but after 5000 files or so I get
Exception in thread "Main" java.io.IOException: The device is not connected
Is this the expected behavior? Is there a way around it? I want to leave my code as straightforward as possible.
Upvotes: 0
Views: 1848
Reputation: 57324
What exactly are you trying to achieve?
Upvotes: 1
Reputation: 75386
It should not be a problem opening thousands of files if you remember to close() your files when you are done using them?
If not, you force the operating system to maintain state for your open files, which usually is a limited resource.
If you really need lots of simultaneous open files, the solution depends on the circumstances. What is it you need to do? Please show code.
Upvotes: 0
Reputation: 81950
An open file has some cost in resources, so that opening another file fails when many files are already open is expected behavior. At least it is expecte by myself.
see for example this: http://www.msfn.org/board/lofiversion/index.php/t101414.html
Upvotes: 0