如何使用java查找webapps目录的路径

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21745970/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 10:27:20  来源:igfitidea点击:

How to find the path of webapps directory using java

javatomcat

提问by NoNaMe

Is there some way to find the path of tomcat's webapps directory using java, as we use System.getProperties("...")to get user.diretc

有什么方法可以使用java找到tomcat的webapps目录的路径,就像我们System.getProperties("...")用来获取user.dir

thanks in advance.

提前致谢。

采纳答案by Dark Knight

You can use System.getProperty( "catalina.base" )for same. And add "/webapps"to path.

您可以使用System.getProperty( "catalina.base" )相同的。并添加"/webapps"到路径。