Re: Trouble loading properties file
On Thu, 20 Jun 2002, Kiev Gama wrote: Hello all, I have the Tomcat 4.0.3 installed, and I am trying to load a .properties file necessary to my application(which has its classes and packages in the WEB-INF/classes) but I haven't got any success in doing this. I'v already tried to put the file in the WEB-INF/classes directory of my application, also tried to jar it and put the jarred file in the WEB-INF/lib. None of the above worked. I wanted to make it easy to transport the whole application without having to save that .properties in a directory outside the application's subdirectories. Does anybody know what I have to do in order to get that to work? Well, you don't give too much info, like where you tried putting it (other than that one location), and how you tried loading it. But my understanding is that if you put a file, say, called filename, immediately under WEB-INF/, you can get to it by doing getServletContext().getResource(filename). Milt Epstein Research Programmer Systems and Technology Services (STS) Campus Information Technologies and Educational Services (CITES) University of Illinois at Urbana-Champaign (UIUC) [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Trouble loading properties file
Milt, I was using the following: Properties p = new Properties(); p.load(new FileInputStream(filename)); but I'll try the getServletContext().getResource(filename) Thanks a lot! Kiev Gama From: Milt Epstein [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: Re: Trouble loading properties file Date: Thu, 20 Jun 2002 16:46:24 -0500 (CDT) On Thu, 20 Jun 2002, Kiev Gama wrote: Hello all, I have the Tomcat 4.0.3 installed, and I am trying to load a .properties file necessary to my application(which has its classes and packages in the WEB-INF/classes) but I haven't got any success in doing this. I'v already tried to put the file in the WEB-INF/classes directory of my application, also tried to jar it and put the jarred file in the WEB-INF/lib. None of the above worked. I wanted to make it easy to transport the whole application without having to save that .properties in a directory outside the application's subdirectories. Does anybody know what I have to do in order to get that to work? Well, you don't give too much info, like where you tried putting it (other than that one location), and how you tried loading it. But my understanding is that if you put a file, say, called filename, immediately under WEB-INF/, you can get to it by doing getServletContext().getResource(filename). Milt Epstein Research Programmer Systems and Technology Services (STS) Campus Information Technologies and Educational Services (CITES) University of Illinois at Urbana-Champaign (UIUC) [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Trouble loading properties file
probably you should try this: InputStream is = getServletContext().getResourceAsStream(/WEB-INF/ + filename); assuming your file is put under /WEB-INF/ directory. --Nimchi -Original Message- From: Kiev Gama [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 20, 2002 5:28 PM To: [EMAIL PROTECTED] Subject: Re: Trouble loading properties file Milt, I was using the following: Properties p = new Properties(); p.load(new FileInputStream(filename)); but I'll try the getServletContext().getResource(filename) Thanks a lot! Kiev Gama From: Milt Epstein [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: Re: Trouble loading properties file Date: Thu, 20 Jun 2002 16:46:24 -0500 (CDT) On Thu, 20 Jun 2002, Kiev Gama wrote: Hello all, I have the Tomcat 4.0.3 installed, and I am trying to load a .properties file necessary to my application(which has its classes and packages in the WEB-INF/classes) but I haven't got any success in doing this. I'v already tried to put the file in the WEB-INF/classes directory of my application, also tried to jar it and put the jarred file in the WEB-INF/lib. None of the above worked. I wanted to make it easy to transport the whole application without having to save that .properties in a directory outside the application's subdirectories. Does anybody know what I have to do in order to get that to work? Well, you don't give too much info, like where you tried putting it (other than that one location), and how you tried loading it. But my understanding is that if you put a file, say, called filename, immediately under WEB-INF/, you can get to it by doing getServletContext().getResource(filename). Milt Epstein Research Programmer Systems and Technology Services (STS) Campus Information Technologies and Educational Services (CITES) University of Illinois at Urbana-Champaign (UIUC) [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- 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]
Re: Trouble loading properties file
Please stop emailing me. I am not a member of Tomcat, nor do I know anything about it. I have never been a member of them I have emailed them several times asking them to remove me from their member email member list, but they have failed to do so. I am asking you to stop. Some of the emails I have recived have had a virus attached to them. Thank you! - Original Message - From: Kiev Gama [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 20, 2002 4:27 PM Subject: Trouble loading properties file Hello all, I have the Tomcat 4.0.3 installed, and I am trying to load a .properties file necessary to my application(which has its classes and packages in the WEB-INF/classes) but I haven't got any success in doing this. I'v already tried to put the file in the WEB-INF/classes directory of my application, also tried to jar it and put the jarred file in the WEB-INF/lib. None of the above worked. I wanted to make it easy to transport the whole application without having to save that .properties in a directory outside the application's subdirectories. Does anybody know what I have to do in order to get that to work? Thanks, Kiev Gama _ Join the world's largest e-mail service with MSN Hotmail. http://www.hotmail.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]
Re: Trouble loading properties file
On Fri, 21 Jun 2002, Kiev Gama wrote: Milt, I was using the following: Properties p = new Properties(); p.load(new FileInputStream(filename)); I think the problem is where is this file being found, i.e. what directory/folder? It might be the current directory, i.e. when the servlet container was started, but who knows what that is. but I'll try the getServletContext().getResource(filename) You should have better luck with this. Note that you might have to use /WEB-INF/filename as the argument to getResource. And you can get a stream from getResource returns, or perhaps use getResourceAsStream instead, to feed to p.load(). From: Milt Epstein [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: Re: Trouble loading properties file Date: Thu, 20 Jun 2002 16:46:24 -0500 (CDT) On Thu, 20 Jun 2002, Kiev Gama wrote: Hello all, I have the Tomcat 4.0.3 installed, and I am trying to load a .properties file necessary to my application(which has its classes and packages in the WEB-INF/classes) but I haven't got any success in doing this. I'v already tried to put the file in the WEB-INF/classes directory of my application, also tried to jar it and put the jarred file in the WEB-INF/lib. None of the above worked. I wanted to make it easy to transport the whole application without having to save that .properties in a directory outside the application's subdirectories. Does anybody know what I have to do in order to get that to work? Well, you don't give too much info, like where you tried putting it (other than that one location), and how you tried loading it. But my understanding is that if you put a file, say, called filename, immediately under WEB-INF/, you can get to it by doing getServletContext().getResource(filename). Milt Epstein Research Programmer Systems and Technology Services (STS) Campus Information Technologies and Educational Services (CITES) University of Illinois at Urbana-Champaign (UIUC) [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]