Return-Path: Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 68784 invoked from network); 31 Aug 2000 15:15:24 -0000 Received: from mail.siapi.es (HELO cms.siapi.es) (194.143.208.4) by locus.apache.org with SMTP; 31 Aug 2000 15:15:24 -0000 Received: from ntserver.nevada (u214.siapi.es [194.143.208.214]) by cms.siapi.es (Netscape Messaging Server 3.62) with ESMTP id 268 for ; Thu, 31 Aug 2000 17:15:17 +0200 Received: by ntserver with Internet Mail Service (5.0.1457.3) id ; Thu, 31 Aug 2000 17:14:52 +0200 Message-ID: <80F5674514B4D311BAFC0040F6A45EEE06E1B3@ntserver> From: Nacho To: "'tomcat-user@jakarta.apache.org'" Subject: RE: file not found error !! Date: Thu, 31 Aug 2000 17:14:48 +0200 X-Priority: 3 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.0.1457.3) Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N Hola ManPreet: use the getRealPath() method of ServletContext this serves to obtain = the path of a file contained within a webapp, thus you can do : FileReader fr=3Dnew FileReader(this.getServletContext().getRealPath("/form.html")); This method returns a String containing the real path for a given virtual path. For example, the virtual path "/index.html" has a real path of whatever file on the server's filesystem would be served by a request for "/index.html".=20 Thislas is an excerpt of tomcat docs, hope this help. Saludos , Ignacio J. Ortega -----Mensaje original----- De: Manpreet Singh [mailto:msingh@india-today.com] Enviado el: mi=E9rcoles 30 de agosto de 2000 16:53 Para: tomcat-user@jakarta.apache.org Asunto: file not found error !! Hi, im writing a small servlet which opens a file. I have added the following context path in the server.xml: Context path=3D"/sam" docBase=3D"webapps/samsung" debug=3D"0" reloadable=3D"true" /Context The code that opens a file is as follows: FileReader fr=3Dnew FileReader("form.html"); Te file is placed in /usr/local/jakarta-home/dist/tomcat/webapps/samsung/ directory. when i run the servlet in the following way : http://mydomain.com/sam/myservlet=20 it gives the file not found exception. I have tried putting the file in all directories from webapps onwards. Any help is appreciated . Thanks, Manpreet.