RE: Accessing environment variables
Yes, there is. But it's not really a good idea. What you ought to do instead is to specify these properties in your web.xml file as a context-param element, like, webapp !-- ... -- context-param param-nameTomcatHome/param-name param-valuec:/tomcat/param-value /context-param /webapp And specifically, I I'm not sure you even need to know TOMCAT_HOME, when you've got methods like ServletContext.getRealPath(). -- Bill K. -Original Message- From: Brandon Cruz [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 15, 2001 2:08 PM To: [EMAIL PROTECTED] Subject: Accessing environment variables I have a question which is somewhat off topic... Is there a way to access my environment varibables(ex. TOMCAT_HOME) from my servlets running in tomcat? I just need to somehow return the path to TOMCAT_HOME. Is there some simple method call that can achieve this? Thanks in advance! Brandon
RE: Accessing environment variables
I'm having problems getting servlets to run in Tomcat running behind IIS. I'm using Tomcat 3.2 My jsps run fine. Can somone send me a sample web.xml file or tell me where to find one for a simple servlet in it's own app. thanks Ross -Original Message- From: Brandon Cruz [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 15, 2001 3:08 PM To: [EMAIL PROTECTED] Subject: Accessing environment variables I have a question which is somewhat off topic... Is there a way to access my environment varibables(ex. TOMCAT_HOME) from my servlets running in tomcat? I just need to somehow return the path to TOMCAT_HOME. Is there some simple method call that can achieve this? Thanks in advance! Brandon
RE: Accessing environment variables
Java system properties are different from environment variables as you probably know. If you look at your start up script (tomcat.sh) you will see that the command is executed with a -Dtomcat.home=${TOMCAT_HOME}. The -D parameter is how you set environment properties for Java at run time. If you use System.getProperty(tomcat.home) you should get what you are looking for. -Jamey -Original Message- From: Brandon Cruz [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 15, 2001 2:08 PM To: [EMAIL PROTECTED] Subject: Accessing environment variables I have a question which is somewhat off topic... Is there a way to access my environment varibables(ex. TOMCAT_HOME) from my servlets running in tomcat? I just need to somehow return the path to TOMCAT_HOME. Is there some simple method call that can achieve this? Thanks in advance! Brandon