Unfortunately System.getenv() is deprecated and doesn't work at all.
The documentation recommends to use System.getProperty() , as states in the previous reply.
However, we need to clarify that these are not the same.... you need to manually translate "environment vars" into "java system properties". This is usually done at the command-line executing java.
Example:
Cumbersome as it might seem, it does a good job separating java from the native platform. This approach is used by various commercial products, including
Tomcat.
In rare cases when you feel there's no way you can take this approach, you can alwasy use the *platrom dependent* alternative, using Runtime.exec: