开发者

Retrieve Local Tomcat Path for File Access

开发者 https://www.devze.com 2023-01-30 04:44 出处:网络
Is there a way to retrieve the Tomcat local GWT directory in order to save a file? In order to retrieve a file it\'s

Is there a way to retrieve the Tomcat local GWT directory in order to save a file?

In order to retrieve a file it's

new File(getClass().getResource(nam开发者_开发百科eOfAFile).getPath());

Therefore how would I retrieve path of the tomcat host in order to save a file 'hello.xml'?


In tomcat, you can use ServletContext.getRealPath() to get the path for a file in your webapp then you can do navigate to "../" to find tomcat dir.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号