Set environment variable in shell script/access in Tomcat Application

According to the docs (http://tomcat.apache.org/tomcat-7.0-doc/RUNNING.txt) you should set all env vars in $CATALINA_HOME/bin/setenv.sh

EDIT: For completeness, I guess it's worth mentioning that even though this is the recommended way, the docs above state that:

By default the setenv script file is absent. If the script file is present both in CATALINA_BASE and in CATALINA_HOME, the one in CATALINA_BASE is preferred.

In case it is absent, you might also want to look for env vars in:

  • /etc/tomcat/tomcat[67].conf (suse) or
  • /etc/default/tomcat[67].conf (e.g. ubuntu) or
  • /etc/sysconfig/tomcat[67].conf (rhel, fedora)