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.
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:
getenv() was present in early versions of Java; then it was deprecated for a few years; then in Tiger, it was un-deprecated, and now there's a shiny new version that returns the whole environment, as Stefan demonstrates.
Sometimes the Javasoft folks give in to a little pressure.