• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Java.io.IOException too many open files

 
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have one class which is creating new FileOutputStream in loop.It is creating 35 files correctly and then after upto 65 files it creates the file but throwing exception JAVA.IO.IOECEPTION :"Cannot create a file when that file already exists" .I have the structure of Class upto 4 classes then after it is create the file in loop.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You've listed two exception messages. Too many files open is usually a case of forgetting to close them. Make sure you close all the files you open, perhaps in a finally block, and see if that helps.

Unable to create a file that already exists I don't know about. Can you copy in the exception from the console?
 
Jignesh Gohel
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for reply i have treind that finally things But it doesn't work I m getting following error
java.io.IOException: Cannot create a file when that file already exists
thanks
 
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So you are getting an IOException, but with which of those error messages?

a) too many open files
b) "Cannot create a file when that file already exists"

Can you perhaps posta small piece of the code too?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic