Hi Gundars
I have used new FileInputStream("servlet.properties") with no problems but then servlet.properties should be in Tomcat /bin directory. Method getClass().getResourceAsStream("servlet.properties"); will work if you have the file in the classpath. regards Maris Orbidans DataPro private String getPropertyFromFile(String name) throws ServletException { try { Properties dbProps = new Properties(); // InputStream propStream = getClass().getResourceAsStream("/servlet.properties"); InputStream propStream = new FileInputStream("servlet.properties"); dbProps.load(propStream); String param = dbProps.getProperty(name); propStream.close(); return param; } catch (Exception e) { log("Error loading properties"+e.toString()); throw new ServletException(); } } -----Original Message----- From: Kevin A. Palfreyman [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 22, 2001 7:21 PM To: Struts Users Mailing List Subject: RE: OFFT: base for file reading in WEB apps Be careful here - getRealPath() can return null when the application is deployed in a WAR if the app server does not expand it (some app server do in fact serve the files straight from the WAR). I got bitten by this recently. Instead try looking at the getResource() and getResourceAsStream() methods. Kev > -----Original Message----- > From: "Moritz Björn-Hendrik, HH" [mailto:[EMAIL PROTECTED]] > Sent: 22 November 2001 14:42 > To: 'Struts Users Mailing List' > Subject: AW: OFFT: base for file reading in WEB apps > > > Hi Gundars, > > you can get the Base-Path by using the > getServletContext().getRealPath("")-Method in the ActionServlet. > > Björn > > > -----Ursprüngliche Nachricht----- > > Von: Gundars Kulups [SMTP:[EMAIL PROTECTED]] > > Gesendet am: Donnerstag, 22. November 2001 15:12 > > An: [EMAIL PROTECTED] > > Betreff: OFFT: base for file reading in WEB apps > > > > Hi! > > I know that this is totally off topic, but what is file > base for file > > operations for classes running in servlet container (Tomcat > in my case). > > For example if I have app.properties file in WEB-INF directory, what > > should > > be the path I need to use to open this file? > > > > WBR, > > > > Gundars Kulups > > Project manager > > A/S Dati > > Phone: +371-7067713 > > Mobile: +371-9466055 > > Fax: +371-7619573 > > > > > > -- > > To unsubscribe, e-mail: > > <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: > > <mailto:[EMAIL PROTECTED]> > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>