I'm trying to write a converter for specific file formats. The converted files should be filtered using a configuration file. Everything works great so far, but I have a problem concerning the reading of a file in a packaged jar.
I have the following structure for my files (Windows):
converter/src/main/resources/files/AStoXES.properties
(there are 3 more property files)
If I'm executing this code in Netbeans everything works fine and the file will be read:
this.fileConfig = new PropertiesConfiguration(new File(testing.class.getClassLoader().getResource("files/AStoXES.properties").toURI()));
But if I'm packaging the jar with Apache Maven
doing a clean install
and run the whole program I'll get a java.lang.IllegalArgumentException: URI is not hierarchical
.
After hours of spending time with Google I have found many threads with the same problem and tested lots of things but none of those proposals helped me out of this problem.
I NEED the contents of the file as a java.io.File
, so using Inputstream
with getResourceAsStream(argument)
won't help me out, because I need to work with the properties in there.
Someone knows how to figure this one out?