To load a properties file bundled with your application:
public class Defaults {
public static Properties loadDefaults() {
try (InputStream bundledResource =
Defaults.class.getResourceAsStream("defaults.properties")) {
Properties defaults = new ...
Take a close look at these two property files which are seemingly completely identical:
except they are really not identical:
(screenshots are from Notepad++)
Since trailing whitespace is preserved the value of lastName would be "Smith" in the first case and "Smith " in th...
Storing Properties in a XML File
The way you store properties files as XML files is very similar to the way you would store them as .properties files. Just instead of using the store() you would use storeToXML().
public void saveProperties(String location) throws IOException{
// make new inst...