Search code examples
jarclassloaderwar

Use in a jar a property file defined in the including war


I have a class which end up bundled in a jar. This class (call it A) use a property file which is accessed via classA.classloader.getRessourceAsStream("META-INF/routes.conf")

there is no such file in the jar. I want to define this file in a war which include this jar.

Is there a way to do so?


Solution

  • Put the file somewhere in the war where it will be on the classpath - root of the classpath would probably be easiest - (WEB-INF\classes) and access it the same way you are now, changing the path to the file to it's location relative to the root of the classpath.