I'm using maven and storing a properties file in src/main/resources
which I can read fine like:
properties.loadFromXML(this.getClass().getClassLoader().
getResourceAsStream("META-INF/properties.xml");
Is it possible to then write to this file when it is packaged up as a jar? I've tried the following:
properties.storeToXML(new FileOutputStream(new File(this.getClass().getClassLoader().
getResource("META-INF/properties.xml").toURI())), "");
This works in Eclipse because it is saving the file to target/classes/META-INF
, but not when packaged as a jar, so is it possible to achieve the same thing?