Wednesday 11 September 2013

What determines the current working directory of Tomcat Java process?

What determines the current working directory of Tomcat Java process?

My production server runs Linux using System V style init scripts.
Tomcat is brought up by running service tomcat7 start as root user
(service runs init script under cwd /).
Tomcat then serves a web page to write the result of new
File(".").getAbsolutePath(), which shows /usr/share/tomcat7/.
But Tomcat init script (/etc/init.d/tomcat7) makes no mention of CWD,
neither does it have any cd command.
Given that Java itself cannot change current working directory, then how
come /usr/share/tomcat7 became Tomcat's current working directory?

No comments:

Post a Comment