Class ddlib.GetEnvironment
All Packages Class Hierarchy This Package Previous Next Index
Class ddlib.GetEnvironment
java.lang.Object
|
+----ddlib.GetEnvironment
- public class GetEnvironment
- extends Object
GetEnvironment is a trivial class that captures the environment
variable using an auxiliary Perl program and returns a corresponding
Hashtable through a static method.
To use it, you need to do three things to the source code and/or your
environment:
-
Take out the "package ddlib" and put the class somewhere on your classpath
(or replace the ddlib with the name of the library package you put it in);
-
Be sure you have perl on your path, or fix the line that invokes it;
-
Be sure you have env.pl in the working directory or fix that same line.
The author makes no warranty that this will work, much less that it
will serve as a programming example.
- Version:
- 1.0
- Author:
- Dan Drake
-
GetEnvironment()
-
-
getEnv()
- Returns a Hashtable containing all environment variables as keys,
and their values as values.
-
main(String[])
- A trivial exerciser for getEnv().
GetEnvironment
public GetEnvironment()
getEnv
public static Hashtable getEnv() throws Exception
- Returns a Hashtable containing all environment variables as keys,
and their values as values.
Functions by calling perl env.pl and capturing the output.
- Throws: Exception
- If it's unable to execute the Perl program, it will throw an
Exception with a helpful error message.
main
public static void main(String args[]) throws Exception
- A trivial exerciser for getEnv(). It ought to print the PATH
when executed on a DOS-ish system.As for Unix,
I don't recall enough shell conventions to know what it will do
there.
- Throws: Exception
- If there's a problem, it will let the Java machine print it out.
All Packages Class Hierarchy This Package Previous Next Index