On 19 Dec 2002 at 11:14, aps olute wrote: > > The problem is someone else had written the support class. The > support class > will only take (File f) as its argument in its constructor. The
You could read your properties, put it into a temp file, which you are guaranteed to be able to create, and pass the temp file. See this very recent message From: "Bill Barker" <[EMAIL PROTECTED]> Subject: Re: How do load a properties file from servlet? Date: Thu, 19 Dec 2002 21:27:00 -0800 > support classes are written by separate developers. I can make > changes to the portion I am responsible for but cant do much with > the other part. Anyhow, the support class is having a fit not > finding this file to read. My servlet sits at > mycontext/WEB-INF/classes/ and the support class sits at > mycontext/WEB-INF/classes/util/ so the relative path to that > support class is then mycontext/WEB-INF/classes/util/ and this is > where I would put the file it needs? > > --- Tim Moore <[EMAIL PROTECTED]> wrote: > > Well when you call getResourceAsStream, the path is resolved > > relative to the package the class is in, so if the servlet and > > the support class are in different packages, this would be > > expected. > > > > What if you call it on the servlet class from the support > > class? > > > > e.g., > > > > InputStream is = > > WhateverTheServletIsCalled.class.getResourceAsStream( > > parmPassedFromServlet ) > > > > or even better, instead of passing the file name from the > > servlet to the support class, why not have the servlet just > > load the properties and pass the properties object to the > > support class? > > > > -- > > Tim Moore / Blackboard Inc. / Software Engineer > > 1899 L Street, NW / 5th Floor / Washington, DC 20036 > > Phone 202-463-4860 ext. 258 / Fax 202-463-4863 > > > > > > > -----Original Message----- > > > From: aps olute [mailto:[EMAIL PROTECTED]] > > > Sent: Thursday, December 19, 2002 1:45 PM > > > To: Tomcat Users List > > > Subject: Re: How to start a standalone app from a servlet and > > > problems with reading properties file > > > > > > > > > > > > Tim, > > > Thanks for responding. Partial success was I was able to > > > read the properties file using code snippet below in the > > > servlet init() method: > > > > > > Properties p = new Properties(); > > > InputStream is = > > > getClass().getResourceAsStream(configFileName); > > > //configFileName is test.properties > > > p.load(is) > > > > > > This property file is loaded and parsed for a property needed > > > by a support class. The parameter read is passed to the > > > support class. When doing exact same InputStream is = > > > getClass().getResourceAsStream(parmPassedFromservlet); in the > > > support class, Tomcat does not start. I posted this earlier > > > last week on: > > > http://marc.theaimsgroup.com/?l=tomcat-user&m=103982860916736 > > > & > > w=2 > > > > Basically, I am facing two issues, 1) dependent on where I > > start Tomcat from and 2) Using getResourceAsStream() fails in > > the support class. Any tips would be appreciated. Thanks. > > > > __________________________________________________ > > Do you Yahoo!? > > Yahoo! Mail Plus - Powerful. Affordable. Sign up now. > > http://mailplus.yahoo.com > > > > -- > > 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]> > > > > > __________________________________________________ > Do you Yahoo!? > Yahoo! Mail Plus - Powerful. Affordable. Sign up now. > http://mailplus.yahoo.com > > -- > 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]>
