I need to load a property file from the jar. The jar is included in war file. Here is the structure
ROOT.war
WEB-INF
lib
my.jar
here my.jar has following structure
my.jar
com
test
myservlet.class
WEB-INF
test.property
Now I have written following code in one of my servlet as follows:
InputStream stream = getServletContext().getResourceAsStream("/WEB-INF/test.properties");
Properties prop = new Properties();
prop.load(stream );
but above code I got stream as null. If I put the property file in ROOT.war/WEB-INF it works fine. I have fair idea that if path in getResourceAsStream starts with '/' than it search resource in context root. But how can I read resource which lies in a jar which again found in WEB-INF/lib of root application?
Thanks & Regards, Amit Patel