How to access environment variable when runing a groovy script ?

My IDEA version is Community  Edition 10.0.2 . I need to acces some environment variables in my groovy  script, for example, I have to get the value of 'HADOOP_HOME'. So I set  the environment variable in the running configura dialog. But the  statement "println System.getenv('HADOOP_HOME')" just gives me the null  value.
However,in a java program in which i use the statement  'System.out.prinltn(System.getenv("HADOOP_HOME");' I can get the right  value.
Is it a bug ? Or have I missed any confguration?