Read a .properties file in a servlet loaded on Tomcat
843842Sep 9 2009 — edited Sep 10 2009Hi,
I am facing some problems when I want to read a properties file. Basically, I have a servlet (ExtractorServlet) which accesses a java class (MessageExtractor.java). This java class reads a properties file (MessageExtractor.properties). For now, I am using this line of code in MessageExtractor.java to load the file:
Properties properties = new Properties();
properties.load(ClassLoader.getSystemResourceAsStream("MessageExtractor.properties"));
when running it on eclipse, it works... but when i load the WAR file to a Tomcat Server, it cant access this file. I tried placing the MessageExtractor.properties file in the /WEB-INF and /WEB-INF/classes directory of the WAR file but still useless...
Would certainly appreciate some help.. thanks in advance!! :)
Cheers,
Khew