It will look in the working directory of the JVM process, not the root directory of the WAR. Where that working directory is depends on how the Tomcat process was started.
As such, you shouldn't do this. You should obtain references to resources from inside the WAR by asking the ServletContext
object (which has various methods to look up resource streams), e.g. from inside a Servlet:
InputStream stream = getServletContext().getResourceAsStream("myfile.properties");
Also, it's bad practice to refer to resources inside a WAR as actual files. This will only work if the WAR is exploded into a directory structure, and won't work if the servlet contain decided to run the WAR as an un-exploded .WAR
file. By sticking to the getResource...()
methods, you keep things neutral and portable.
However if, as you say, you cannot change the code, then that's a problem, because the code is broken and badly written. You'll need to figure out how to launch Tomcat so that the working directory is in the "correct" place. That might entail hacking the startup scripts.