Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Working directory of a Tomcat webapp

Tags:

java

tomcat

I have a Java web application that is deployed on an Apache Tomcat 6 Server. The application includes an info.properties file that is added to the classpath, and has several hard coded values, which are read during runtime.

I now need to remove a certain value from the info.properties file, and build the value (a String, that of path to the bin folder of the same Tomcat installation) instead.

How do I get the working directory of my application during runtime and then add a relative path (from the info.properties file ) to access the bin folder?

Thanks

like image 746
wrahool Avatar asked Oct 25 '25 00:10

wrahool


1 Answers

Tomcat home directory or Catalina directory is stored at the Java System Property environment. If the Java web application is deployed into Tomcat web server, we can get the Tomcat directory with the following command:

System.getProperty("catalina.base");

Here you can move inside Tomcat folder and open bin easily

like image 147
Tonino Avatar answered Oct 26 '25 16:10

Tonino



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!