Howdy ;)
By definition (see servlet spec), you can't read anything under WEB-INF.

If you could, the right approach would be like  
String path = getServletContext().getRealPath("/WEB-INF/classes")
File directory = new File(path);
...

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: Simon Wong [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, June 18, 2002 2:58 PM
>To: [EMAIL PROTECTED]
>Subject: RE: Please help with Tomcat - newbie
>
>Hello,
>
>I am trying to get the servlet to obtain a list of filenames and
>directories in my servlet class to be sent back to the applet. However,
I
>am not sure if my approach is correct.
>I used the following code in my servlet class in the directory:
C:\(where i
>installed my tomcat)\Apache Tomcat 4.0\webapps\ROOT\WEB-
>INF\classes\MyServlet.class
>Codes in the class:
>File directory = new File("classes");
>File [] filenames = directory.listFile();
>>> The result i get is null. No directory name "classes".
>However, when I tried using "." (I presume it means current directory),
it
>seems to be in windows/system32 ??
>I am quite confused about this. How do I actually refer to the
directory I
>mentioned above? Do I need to configure anything? I really need help!
Your
>advise will be much appreciated. Thanks
>
>Best Regards,
>Simon

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to