tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <>
Subject RE: Please help with Tomcat - newbie
Date Tue, 18 Jun 2002 20:03:27 GMT
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 []
>Sent: Tuesday, June 18, 2002 2:58 PM
>Subject: RE: Please help with Tomcat - newbie
>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,
>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-
>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),
>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!
>advise will be much appreciated. Thanks
>Best Regards,

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message