This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Applets and the fly likes Read the contents of a folder Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Applets
Bookmark "Read the contents of a folder" Watch "Read the contents of a folder" New topic
Author

Read the contents of a folder

Tom Hazelton
Greenhorn

Joined: May 27, 2004
Posts: 2
Hello all,

Here's my problem. I'm trying to read the contents of a folder on the server where my applet is stored, and add all filenames to a combo box. I've been able to read individual files for settings and such using code like:


But I'm wondering if it's possible to read a folder this way, somehow get a list of the contents, and play with that instead. If not, I might have to make a file listing the contents of the folder, but ideally, I want files to be uploaded at any time and have the applet just pick up on it, without having to edit files or anything.

Any suggestions? Thanks!
[ May 27, 2004: Message edited by: Tom Hazelton ]
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 9137
    
    9

You can list the contents of a directory using java.io.File. Of course, you can't use a File object across a network connection so you will probably need to create a servlet to use the File and return the results.


[How To Ask Questions On JavaRanch]
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Read the contents of a folder
 
It's not a secret anymore!