Issue
I have this piece of code:
Paths.get("conf/app.properties").toAbsolutePath()
When I run it in Tomcat 7, it properly resolves to a relative directory, using $CATALINA_HOME
. But when I run it in Tomcat 9, it "resolves" to /conf/app.properties
which obviously doesn't exist. How do I get Tomcat 9 to properly resolve the path?
Solution
I checked this answer - seems to be doing something close to what you need: Reading properties from tomcat
I came up quickly from that to something like:
<%= new File(System.getProperty("catalina.base"), "conf").getAbsolutePath() %>
Answered By - Vasil Svetoslavov