简体   繁体   中英

using a 'environment' variable in java servlet running in tomcat container

I need to access a variable created in a shell script from a java servlet. After reading the related posts in this forum I still haven't figured it out. If I export a variable on my debian system (export var=foo123) and then I want to use this variable in my sevlet (System.getenv(var)) it always returns a null value.

I have already tried adding 'export var=foo123' in /etc/init.d/tomcat7 but to no succes.

I think that you don't need to use export, it should be enough to put:

 VARIABLE_NAME="variable_value" 

in tomcat script file. And don't forget the ""!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM