views:

1177

answers:

3

Is there a Java equivalent to .NET's App.Config?

If not is there a standard way to keep you application settings, so that they can be changed after an app has been distributed?

+2  A: 

The simple way is to simply have a properties file, e.g., myapp.properties, with all your settings in. It's not a very advanced way to do settings but it suffices, or you can have your own XML based setup, or get them from a database, etc.

JeeBee
+4  A: 

For WebApps, web.xml can be used to store application settings.

Other than that, you can use the Properties class to read and write properties files.

You may also want to look at the Preferences class, which is used to read and write system and user preferences. It's an abstract class, but you can get appropriate objects using the userNodeForPackage(ClassName.class) and systemNodeForPackage(ClassName.class).

R. Bemrose
A: 

Can someone give an example of the web.xml file and code on how the variable and values in the web.xml can be used in a java applicaiton?

inini
This should be posted as a separate question
Omar Kooheji