You’ll often want to configure parameters in a properties file and read this into a class.
config.properties:
value.a=orange
value.b=apple
If you’re simply loading a file in a java program you can use:
Properties props = new Properties();
props.load(new FileInputStream(“config.properties”));
String value = props.getProperty(“value.a”);
But when loading a property file in a web application you should package the file in your deployed archive and [...]
Entries from March 31st, 2009
Loading a properties file in a java web app
March 31st, 2009 No Comments
Tags: java · properties