简体   繁体   中英

Finding tomcat installation directory

I have installed tomcat in my PC (Windows 10). Is there anyway that I can find the installation path of tomcat? I thought of making use of the command line with which java used to call the startup.bat file but then I realized that the command line keeps changing depending on how it is called. I have to find the installation path of tomcat programmatically using c++.

Updated : I need to find the installation path only if tomcat is running

You could execute jps -lv and parse the results.

A Tomcat Java process would look like

12345 org.apache.catalina.startup.Bootstrap ... -Dcatalina.base=<some_path> ...

Where 12345 is the PID and <some_path> is the home of Tomcat.

Beware that there could be multiple instances of Tomcat running.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM