Not sure if a type or not, but you are using two different file names. myfile01.txt and file01.txt.
May want to double-check that. Joseph Karau Kingland Systems [EMAIL PROTECTED] 507-536-3629 AIM: jkara3629 -----Original Message----- From: Richard Yee [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 17, 2002 1:36 PM To: [EMAIL PROTECTED] Subject: Re: File not found??? CL, You need to use the getRealPath() method in the ServletContext class in order to get the path to the file in your web application. String myPath = getServletConfig().getServletContext().getRealPath("/WEB-INF/files/myfile01. txt"); br = new BufferedReader(new FileReader(path)); In order to check to see if your path string is correct, you should check and make sure myPath is not null. If it is null, then the path is incorrect. This problem can also be found in the archives of the servlet-interest mailing list. Regards, Richard At 10:57 AM 4/17/2002 -0700, you wrote: >I have a file D:\tomcat4.0/webapps/myroot/WEB-INF/files/myfile01.txt > > >A/ If I try to open file01.txt on the command line, it is ok. >D:\tomcat4.0/webapps/myroot/WEB-INF/classes>java MyApp files/myfile01.txt > > >B/ However, I have problem when running a servlet, >D:\tomcat4.0/webapps/myroot/WEB-INF/classes/MyServlet.class > >http://myserver:8080/myroot/servlet/MyServlet > >1/ I can list all the files in D:\tomcat4.0\webapps\myroot\WEB-INF\files > >2/ I can not open this file; I get error message to open >java.io.FileNotFoundException: /WEB-INF/files/file01.txt (The system >cannot find the path specified) > >I try to open unsuccessful with >br = new BufferedReader(new FileReader("/WEB-INF/files/file01.txt ")); >br = new BufferedReader(new FileReader("WEB-INF/files/file01.txt ")); > > >Thanks, >CL > >=========================================================================== >To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff >JSP-INTEREST". >For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". >Some relevant FAQs on JSP/Servlets can be found at: > > http://archives.java.sun.com/jsp-interest.html > http://java.sun.com/products/jsp/faq.html > http://www.esperanto.org.nz/jsp/jspfaq.jsp > http://www.jguru.com/faq/index.jsp > http://www.jspinsider.com =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com