Through this example, we can learn about how to get the Tomcat home directory in Java.
Source Code
package com.beginner.examples;
public class GetTomcatHome {
public static void main(String[] args) {
String path=System.getProperty("catalina.home");
System.out.println(path);
}
}
Output:
C:developapache-tomcat-7.0.75