Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 75617 invoked from network); 14 May 2003 05:57:05 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 14 May 2003 05:57:05 -0000 Received: (qmail 10974 invoked by uid 97); 14 May 2003 05:59:19 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@nagoya.betaversion.org Received: (qmail 10967 invoked from network); 14 May 2003 05:59:19 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 14 May 2003 05:59:19 -0000 Received: (qmail 74128 invoked by uid 500); 14 May 2003 05:56:48 -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 74111 invoked from network); 14 May 2003 05:56:48 -0000 Received: from rwcrmhc52.attbi.com (216.148.227.88) by daedalus.apache.org with SMTP; 14 May 2003 05:56:48 -0000 Received: from nicki.visi.com (c-24-118-17-192.mn.client2.attbi.com[24.118.17.192]) by attbi.com (rwcrmhc52) with SMTP id <2003051405565805200sso8le>; Wed, 14 May 2003 05:56:58 +0000 Message-Id: <5.2.0.9.2.20030514005330.02f2aca8@shell.visi.com> X-Sender: hoju@shell.visi.com X-Mailer: QUALCOMM Windows Eudora Version 5.2.0.9 Date: Wed, 14 May 2003 00:58:45 -0500 To: "Tomcat Users List" From: Jacob Kjome Subject: Re: still problem to load a property file in tomcat4.1.24??? In-Reply-To: <00ed01c319dc$004865b0$c00010ac@atl.mdc.apar.com> References: <9C5166762F311146951505C6790A9CF858EA39@US-VS1.corp.mpi.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=====================_574248031==.ALT" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N --=====================_574248031==.ALT Content-Type: text/plain; charset="us-ascii"; format=flowed See: http://marc.theaimsgroup.com/?l=tomcat-user&m=103904964313189&w=2 It will show you a number of different ways to do what you require. Actually, pretty much all possible way to do what you require. Jake At 11:15 AM 5/14/2003 +0530, you wrote: >Hi, > >I have written a simple jsp page and in that i am trying to load a config >file for my application > >Properties prop = new Properties(); >try >{ > InputStream fin = >ClassLoader.getSystemResourceAsStream("Shyam.config"); > prop.load(fin); > System.out.println("File Loaded Successfully"); > } > catch(Exception e) > { > e.printStackTrace(); > } >} > >But this is giving error as its not able to load Shyam.config file. which is >in WEB-INF/classes folder in my application. > >Please show me a way. > >Thanks > >Pawan > > >-----Original Message----- >From: Shapira, Yoav [mailto:Yoav.Shapira@mpi.com] >Sent: Tuesday, May 13, 2003 6:47 PM >To: Tomcat Users List; pawan.s@apar.com >Subject: RE: how to load a property file in tomcat4.1.24??? > > > >Howdy, >RTFM: >http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.html > >Or search the archives. > >WEB-INF/classes is automatically on the "classpath" for your webapp and >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 when >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 ="Shyam.config"; > > > >static > > { > > try > > { > > cfg = getAlertConfig(); > > } > > catch(Exception e){} > > } > > > > public static Properties getAlertConfig() throws IOException > > { > > > > Properties prop = new Properties(); > > try > > { > > InputStream fin = > >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 >communication, and may contain information that is confidential, proprietary >and/or privileged. This e-mail is intended only for the individual(s) to >whom it is addressed, and may not be saved, copied, printed, disclosed or >used by anyone else. If you are not the(an) intended recipient, 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 > >--------------------------------------------------------------------- >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org --=====================_574248031==.ALT--