hmm... i do it like this: https://github.com/yandex-qatools/properties/blob/master/properties-loader/src/main/java/ru/yandex/qatools/properties/utils/PropertiesUtils.java#L28
it works fine lot of time.