Env var

How to get environmental variables using pure java code that works across JVM and OS?
[99 byte] By [goask] at [2008-2-21]
# 1
System.getProperty("name of property");
morgalr at 2007-6-29 > top of java,Archived Forums,Portability & Platform Independence [Archive]...
# 2
Wrong. That gives you a system property (JVM). It does not give you an OS environment variable. There is no way that I know of to do this.
schillj at 2007-6-29 > top of java,Archived Forums,Portability & Platform Independence [Archive]...
# 3
If you use jvm's before 1.3, and if the OS has env vars (not all do) then you can use System.getenv().If not then the closest one can get is to pass in on the command line via -D
jschell at 2007-6-29 > top of java,Archived Forums,Portability & Platform Independence [Archive]...