2

I am having this very weird issue.

I have one servlet in which I want to access one system variable.

As per this documentation I have set my environment variable in /etc/environment as

TEMP=Temp.something

Now when I do printenv TEMP I get

Temp.something

Also I have wrote simple program like this

public class env {
        public static void main(String[] args) {
                String test = System.getProperty("TEMP");
                System.out.println(test);
        }
}

which outputs

Temp.something

Now, I have wrote one servlet which is deployed on tomcat on the same machine, which has this statement

System.out.println("Config : " + System.getenv("TEMP"));

This always prints null.
I'm pretty new to servlets. Is something I'm missing?

Community
  • 1
  • 1
Ganesh Satpute
  • 3,664
  • 6
  • 41
  • 78

1 Answers1

0

I had to make entry inside /usr/share/tomcat7/bin/setenv.sh

TEMP=Temp.something

I'm not sure why do I had to do this. When I say get system environment variable it should get me system variable :(

Ganesh Satpute
  • 3,664
  • 6
  • 41
  • 78