Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find the path of webapps directory using java

Tags:

java

tomcat

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

thanks in advance.

like image 644
NoNaMe Avatar asked Feb 13 '14 05:02

NoNaMe


People also ask

How to get the server path in Java?

In Java, for NIO Path, we can use path. toAbsolutePath() to get the file path; For legacy IO File, we can use file. getAbsolutePath() to get the file path.

Where is Tomcat webapps folder?

The default appBase location is "$CATALINA_BASE/webapps", or "$CATALINA_HOME/webapps", if no base directory has been defined.


1 Answers

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

like image 122
Dark Knight Avatar answered Oct 12 '22 22:10

Dark Knight