13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 4Where Am I?Executi<strong>on</strong> C<strong>on</strong>textJava claims—and rightly so—to be a “compile <strong>on</strong>ce, run anywhere” language.But when a program starts, that “anywhere” is now a specific somewhere. Whenrunning a Java applicati<strong>on</strong> <strong>on</strong> <strong>Linux</strong>, or any envir<strong>on</strong>ment for that matter, thequesti<strong>on</strong> arises, “Where am I?” (c<strong>on</strong>text, envir<strong>on</strong>ment, familiar landmarks).What can a Java program find out about its envir<strong>on</strong>ment? In particular, <strong>on</strong> the<strong>Linux</strong> platform, (how) can we get at:• Command-line parameters?• The current shell’s envir<strong>on</strong>ment variables?• The current working directory?• The locati<strong>on</strong> of data files?The answers to these questi<strong>on</strong>s will depend <strong>on</strong> what kind of Java applicati<strong>on</strong>you are creating, and just how portable you want your applicati<strong>on</strong> to be.99

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!