File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes what is the maximum size?  File [] files = dir.listFiles() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "what is the maximum size?  File [] files = dir.listFiles() " Watch "what is the maximum size?  File [] files = dir.listFiles() " New topic
Author

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

Jennifer McAllister
Greenhorn

Joined: Jan 14, 2003
Posts: 2
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

Joined: Jan 30, 2000
Posts: 18671
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.


"I'm not back." - Bill Harding, Twister
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: what is the maximum size? File [] files = dir.listFiles()
 
Similar Threads
Determining Folder/File Size
Sending 1GB files over the network
New to web service: Two additional questions
Images is too big....
max size limit of file to be uploaded