|Table of Contents|
Your Java programs run within some environment. That is, the program runs in an environment where there's a host machine, a current directory, user preferences for window color, font, font size, and other environmental attributes. In addition to these system (or runtime) attributes, your program can set up certain, configurable, program-specific attributes. Program attributes are often called preferences and allow the user to configure various startup options, preferred window size, and so on.
A program might need information about the system environment to make decisions about how to do something or what to do. Also, a program might modify certain attributes itself or allow a user to change them. Thus a program needs to be able to read and sometimes modify various system attributes and program-specific attributes. Java programs can manage program attributes through three mechanisms: properties, application command line arguments, and applet parameters.
Setting Up and Using PropertiesProperties define environmental attributes on a persistent basis. That is, use properties when attribute values need to persist between invocations of a program.
Application Command Line ArgumentsCommand line arguments define attributes for Java applications on a non-persistent basis. You use command line arguments to set one or more attributes for a single invocation of an application.
Note: The Java language supports command line arguments. However, for some systems (such as Macintosh) command line arguments don't make sense. To avoid platform dependencies in your Java applications avoid the use of command line arguments and use properties instead.
Applet ParametersApplet parameters are similar to command line arguments but are used with applets, not applications. Use applet parameters to set one or more attributes for a single invocation of an applet. For information about applet parameters, see Defining and Using Applet Parameters.
|Table of Contents|