• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

what is the maximum size? File [] files = dir.listFiles()

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have over 1000 files and when my program fails around this line:
File [] files = dir.listFiles();
It works with a little over 500 files. Is there a maximum size it can handle? each file is about 4k.
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't believe there's any max as far as Java is concerned, other than Integer.MAX_VALUE which limits the size of any array. Perhaps there's some platform limitation? What exactly happens when this method fails? Is an exception thrown? What if you list files outisde Java, using OS commands - can you list all 1000 files? You can probably list the files to a new file - e.g. (for Windows)
(Don't put the new output file in the same directory you're trying to list - that just confuses things.) Once you have the output in a file, you can see how many lines there are, and check for any other anomalies.
reply
    Bookmark Topic Watch Topic
  • New Topic