I wonder which of the following is a preferred approach?
We can set things up as APP_HOME=/path/to/file
(export
in .profile
or som
If you are using Java 1.3 or 1.4 (and 1.2, IIRC), you should be using system properties, since System.getenv
was deprecated. It was reinstated in Java 1.5. The relevant bug report can be found here.
You can use both. Search system properties for the key, and if it's not there, search the environment. This gives you the best of both worlds.
These really aren't the same thing: One requires the value to be set explicitly, and the other not. Also, note that the environment is a convenient place to put some strings for interoperability.