listFiles() or list() not working on linux.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Srikanth_k
Posted On:   Wednesday, November 29, 2006 03:37 AM

To get list of files in a directory, we use listFiles() method of java.io.File. but this is not working in linux.

For Example,

java.io.File src=new java.io.File("usr/local/jboss/dsmimage/rpodev/scanned/");
java.io.File kFileList[]=new java.io.File[10];
kFileList=src.listFiles();


Here i am getting kFileList null.


Please Help me in this issue and suggest me some method to get list of files from linux path.


Thanks & Regards
Srikanth


Please use html tags to format code blocks.

Re: listFiles() or list() not working on linux.

Posted By:   Anonymous  
Posted On:   Wednesday, November 29, 2006 05:35 AM

Have you tried src.exists() and src.isDirectory() to check if
the directory actually exists in the file system?

Also, "usr/local/jboss/dsmimage/rpodev/scanned/" is a relative path to the working directory of the VM. If you are looking for a directory under "/usr", and the VM is not started in "/", you should pass "/usr/local/jboss/dsmimage/rpodev/scanned/" when creating the 'src' File.
About | Sitemap | Contact