• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Jennifer McAllister
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic