how to get relative path of current directory in tomcat from linux environment using java

后端 未结 3 1261

I would like to use to read properties file from out side of the my web application. I was deployed a war file in tomcat in windows environment and I am able to read properties

3条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-04 18:08

    If your code runs inside a servlet, it may be simpler to use getServletContext().getRealPath("/strs.properties") to retrieve the absolute file path.

提交回复
热议问题