Dheeraj, When you run any code as a service with the default local system account it does not have permissions to use network shares.
You could try running the service using a specific user account which has access to the share or alternatively load the file using ftp, http or some other protocol which does not require user authentication. You would then need to have an ftp server or webserver etc running on the file server machine. Best regards Robert -----Original Message----- From: Soti, Dheeraj [mailto:[EMAIL PROTECTED] Sent: 14 October 2005 18:20 To: users@tomcat.apache.org Subject: How to read files on a network drive from a JSP > Hi, > > I have to list the files on a particular folder on a network drive. My > code is: > > File f = new File("\\\\host_ip_address\\folder1\\folder2"); > File files[] = f.listFiles(); > System.out.println("===========>>>Files are: " + files); > > The same code works from a standlone java program but not from a JSP. > Even from a JSP if I start Tomcat from command prompt using > startup.bat it works fine but not when I start it as a service. > > Any ideas? > > Thanks > > Dheeraj > -------------------------------------------------------- The information contained in this message is intended only for the recipient, and may be a confidential attorney-client communication or may otherwise be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, please be aware that any dissemination or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify us by replying to the message and deleting it from your computer. -------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]