> From: Xi Chen [mailto:[EMAIL PROTECTED] > Subject: How to configure in Tomcat? > > I set up the environment variable (MY_CONFIG_FILE_PATH) correctly on > the machine, and the class function all right if I test it via a > command line. > > However, if I test the class under Tomcat (after deploy the class to > the appropriate path under Tomact) on the same machine, it complains > that it cannot find the path.
Giving us a hint about what OS you're using might help, along with the mechanism you're using to start Tomcat. If you're running it as a Windows service, environment variables will not be available. (Don't confuse environment variables with system properties like a previous respondent did - they're entirely separate.) Reading properties files or other configuration this way will be conainer and platform specific; you may well be better off using ServletContext.getResourceAsStream() or Class.getResourceAsStream(), which would make your app more portable. See the Servlet spec, the mailing list archives, and Google for details. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]