The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
September 2000

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

RE:Environment variables

Posted by manisha on October 17, 2000 at 9:10 PM


Well, the System.getProperties() does not give you user defined Environment variables.
For getting those variables you can set the property while running the java program:
e.g.
java -DmyDir=%MyAppDir% MyJavaApp

where %MyAppDir% will pickup the environment variable 'MyAppDir'.
and assign it to property myDir.

And then you can access 'myDir' using System.getProperties()

I am looking for better way to retrive environment variables.
If anybody can help, pls. do.
Thanks in Advance


> I would like to get some environment variables in a Java Program written in JDK 1.1.8, but the System.getenv() method is deprecated.
> Is it possible to do this in a simple way ?

> Thanks






Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us