I’m trying to access a config file from a a servlet inside of .war-file. The problem is, that the default file path is the tomcat root itself and hardcoding the path to the file seems not like an option either. Is it possible to get any information through the ServletContext or any Tomcat variables?
Share
If you put the file in the ‘classes’ directory under your specific webapps directory (./webapps/{servlet}/classes) then you can access it from inside a Java class by doing this :
so if you had a conf file at /webapps/myServlet/classes/conf.xml