Return-Path: Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: (qmail 16772 invoked from network); 15 May 2010 19:02:47 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 15 May 2010 19:02:47 -0000 Received: (qmail 1986 invoked by uid 500); 15 May 2010 19:02:46 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 1929 invoked by uid 500); 15 May 2010 19:02:46 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 1920 invoked by uid 99); 15 May 2010 19:02:46 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 15 May 2010 19:02:46 +0000 X-ASF-Spam-Status: No, hits=-1495.2 required=10.0 tests=ALL_TRUSTED,AWL,T_FRT_PROFILE2 X-Spam-Check-By: apache.org Received: from [140.211.11.130] (HELO eos.apache.org) (140.211.11.130) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 15 May 2010 19:02:43 +0000 Received: from eos.apache.org (localhost [127.0.0.1]) by eos.apache.org (Postfix) with ESMTP id 32FD616E2F; Sat, 15 May 2010 19:02:23 +0000 (GMT) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Apache Wiki To: Apache Wiki Date: Sat, 15 May 2010 19:02:22 -0000 Message-ID: <20100515190222.19325.65888@eos.apache.org> Subject: =?utf-8?q?=5BTomcat_Wiki=5D_Update_of_=22HowTo=22_by_hotmaz?= Dear Wiki user, You have subscribed to a wiki page or wiki category on "Tomcat Wiki" for ch= ange notification. The "HowTo" page has been changed by hotmaz. http://wiki.apache.org/tomcat/HowTo?action=3Ddiff&rev1=3D90&rev2=3D91 -------------------------------------------------- // assuming you want to load application.properties located in = WEB-INF/classes/conf/ String propFile =3D "conf/application.properties"; java.net.URL url =3D loader.getResource(propFile); - try{prop.load(url.openStream());}catch(Exception e){Syste,.err.println= ("Could not load configuration file: " + propFile);} + try{prop.load(url.openStream());}catch(Exception e){System.err.println= ("Could not load configuration file: " + propFile);} } = //.... @@ -50, +50 @@ } }}} = - This method even works in a standalone java application. So it is my pref= erred way. + This method even works in a standalone java application. So it is my pref= erred way. (see also [[http://knowhow.amazers.net/space/dev/java+tips/Loadi= ng+properties+in+a+web+application|this article]]) = * Use a `ResourceBundle`. See the Java docs for the specifics of how the= `ResourceBundle` class works. Using this method, the properties file must = go into the `WEB-INF/classes` directory or in a jar file contained in the `= WEB-INF/lib` directory. =20 --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org