Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 67833 invoked from network); 13 May 2003 13:19:06 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 13 May 2003 13:19:06 -0000 Received: (qmail 7678 invoked by uid 97); 13 May 2003 13:21:11 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@nagoya.betaversion.org Received: (qmail 7671 invoked from network); 13 May 2003 13:21:10 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 13 May 2003 13:21:10 -0000 Received: (qmail 66222 invoked by uid 500); 13 May 2003 13:18:27 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 66208 invoked from network); 13 May 2003 13:18:27 -0000 Received: from unknown (HELO mustang.mpi.com) (63.244.250.132) by daedalus.apache.org with SMTP; 13 May 2003 13:18:27 -0000 Received: from thunderbolt.mpi.com (thunderbolt.mpi.com [199.93.192.55]) by mustang.mpi.com (Switch-2.2.6/Switch-2.2.6) with ESMTP id h4DDHfo23169; Tue, 13 May 2003 09:17:42 -0400 (EDT) Received: from US-VS1.corp.mpi.com (us-be1.corp.mpi.com [199.93.195.20]) by thunderbolt.mpi.com (Switch-3.0.4/Switch-3.0.0) with ESMTP id h4DDHBO4022656; Tue, 13 May 2003 09:17:41 -0400 (EDT) X-MimeOLE: Produced By Microsoft Exchange V6.0.6375.0 Content-Class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: how to load a property file in tomcat4.1.24??? Date: Tue, 13 May 2003 09:17:27 -0400 Message-ID: <9C5166762F311146951505C6790A9CF858EA39@US-VS1.corp.mpi.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: how to load a property file in tomcat4.1.24??? thread-index: AcMZUY+rSnGScyBnTC6rhIBTYxy+5AAAE7gQ From: "Shapira, Yoav" To: "Tomcat Users List" , X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Howdy, RTFM: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.htm= l Or search the archives. WEB-INF/classes is automatically on the "classpath" for your webapp an= d JSP. You don't need to modify the classpath environment variable nor any of the classpaths in tomcat's startup scripts. Yoav Shapira Millennium ChemInformatics >-----Original Message----- >From: pawan [mailto:pawan.s@apar.com] >Sent: Tuesday, May 13, 2003 9:12 AM >To: 'Tomcat Users List' >Subject: how to load a property file in tomcat4.1.24??? > >Hello Everyone, > >in my application's web-inf/classes folder i have a package named "common" >in that i have a file "Alerter.java" > >in which i am loading a property file in static block, by using the >ClassLoader.. now to load ALERT_CONFIG_FILE this file should eb in >classpath. so i have set the classpath to > >C:\jakarta-tomcat-4.1.24\webapps\shyam\WEB-INF\classes > >and i have put my file Shyam.config in there. But its giving error wh= en i >call this class by a jsp page in tomcat. > >Its working file if i use command line argument e.g. >C:\jakarta-tomcat-4.1.24\webapps\shyam\WEB-INF\classes>java common.Alerter > >I think i need to set the CLASSPATH variable for tomcat window where all >console output comes. > >Please help me how i can make it work?? Or is there any other alternative?? > >Thank you in advance. > >*********************************************************************= ** >Here is a part of source code >*********************************************************************= ** > > >private static final String ALERT_CONFIG_FILE =3D"Shyam.config"; > >static > { > try > { > cfg =3D getAlertConfig(); > } > catch(Exception e){} > } > > public static Properties getAlertConfig() throws IOException > { > > Properties prop =3D new Properties(); > try > { > InputStream fin =3D >ClassLoader.getSystemResourceAsStream(ALERT_CONFIG_FILE); > prop.load(fin); > System.out.println("File Loaded Successfully"); > } > catch(Exception e) > { > System.out.println("Either ALERT Configuration file: '" >+ALERT_CONFIG_FILE+"' Not found in CLASSPATH or it can not be read");= > } > System.out.println("........"+prop); > return prop; > } > > >---------------------------------------------------------------------= >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org This e-mail, including any attachments, is a confidential business com= munication, and may contain information that is confidential, propriet= ary and/or privileged. This e-mail is intended only for the individua= l(s) to whom it is addressed, and may not be saved, copied, printed, d= isclosed or used by anyone else. If you are not the(an) intended reci= pient, please immediately delete this e-mail from your computer system= and notify the sender. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org