Java Reference
In-Depth Information
Chapter 4
Where Am I?
Execution Context
Java claims—and rightly so—to be a “compile once, run anywhere” language.
But when a program starts, that “anywhere” is now a specific somewhere. When
running a Java application on Linux, or any environment for that matter, the
question arises, “Where am I?” (context, environment, familiar landmarks).
What can a Java program find out about its environment? In particular, on the
Linux platform, (how) can we get at:
• Command-line parameters?
• The current shell's environment variables?
• The current working directory?
• The location of data files?
The answers to these questions will depend on what kind of Java applica-
tion you are creating, and just how portable you want your application to be.
99
Search WWH ::




Custom Search