What do you mean with 'classpath'? Tomcat ignores the classpath environment variable. So your property file has to reside in a directory that is known to tomcat. Even using the SystemClassLoader (which is done when you use getSystemResource()) won't help because the classpath is cleared in the startsrcipt of tomcat.
So the file has to one of these: * webapps/{Context}/WEB-INF/classes/com/foo/My.properties * $CATALINA_BASE/common/classes/com/foo/My.properties * $CATALINA_BASE/classes/com/foo/My.properties To read more about this: http://jakarta.apache.org/tomcat/tomcat-4.0-doc/class-loader-howto.html BTW: Is there any reason why you use getSystemResource() instead of getSystemResourceAsStream() ? Ralph Einfeldt Uptime Internet Solution Center GmbH Hamburg, Germany Hosting, Content Management, Java Consulting http://www.uptime-isc.de > -----Ursprüngliche Nachricht----- > Von: petra staub [mailto:[EMAIL PROTECTED]] > Gesendet: Donnerstag, 1. August 2002 16:05 > An: [EMAIL PROTECTED] > Betreff: Reading properties file from ClassPath > (ServletContextListener) > > I have a registered class as a ServletContextListener. > At application start I want to read a Properties file > from the classpath, doing the following: > > myProps = new Properties(); > try { > URL url = ClassLoader.getSystemResource("com/foo/My.properties"); > InputStream istream = url.openStream(); > myProps.load(istream); > } catch (Exception exp) { > > } > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>