Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-08-2008, 08:13 PM
Member
 
Join Date: Dec 2007
Posts: 80
willemjav is on a distinguished road
Is there a way to read a file directory
Best java friends

Is there a way to read a file directory in a specific folder inside the work directory form a applet . The following code does not work in an applet:

directory = new File(dirname);
if (directory.isDirectory() == false) {
if (directory.exists() == false)
…………
files = directory.list(); // stores the list of file names


willemjav
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-17-2008, 04:52 PM
sukatoa's Avatar
Senior Member
 
Join Date: Jan 2008
Location: Cebu City, Philippines
Posts: 508
sukatoa is on a distinguished road
Send a message via Yahoo to sukatoa
For security reasons, you can't actually..... ( im not sure )

try to search it on the web....
specially the article about Advantage/disadvantage of Applets....

sukatoa.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 04-17-2008, 05:54 PM
DonCash's Avatar
Moderator
 
Join Date: Aug 2007
Location: London, UK
Posts: 237
DonCash will become famous soon enoughDonCash will become famous soon enough
This code will list all the files in a given directory. In this case its '.' which is the current working directory:

Code:
String path = "."; File folder = new File(path); File[] listOfFiles = folder.listFiles(); for (int i = 0; i < listOfFiles.length; i++) { if (listOfFiles[i].isFile()) { files = listOfFiles[i].getName(); System.out.println(files); } }
__________________
Did this post help you? Please
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
me!

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|| Don't forget to:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get Current Directory through File Java Tip java.io 0 04-05-2008 11:14 AM
How to read a text file from a Java Archive File Java Tip Java Tips 0 02-08-2008 10:13 AM
signaling file(s) have reached in directory ashu261 Advanced Java 0 02-04-2008 08:45 AM
Read file tajinvillage Threads and Synchronization 0 01-29-2008 10:10 AM
How to Move a File to Another Directory Ada New To Java 1 05-26-2007 02:17 PM


All times are GMT +3. The time now is 07:44 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org